Applies To:
  • CitectSCADA 5.xx
  • CitectHMI 5.xx

Notes for using the DspPopupMenu function to display popup menus in the Citect runtime. 

1. This function is included in Citect 5.42 but can be added to older Citect versions by downloading CUTIL from the Citect Website | MyCitect Downloads | Toolbox | Cicode.

2. DspPopupMenu returns -1 when adding items to a menu

3. DspPopupMenu returns -1 if the menu could not be displayed because another menu is currently shown. This can be avoided by using semaphores. Call EnterCriticalSection("DspPopupMenu") before calling DspPopupMenu. Call LeaveCriticalSection("DspPopupMenu") afterwards. This causes other threads to wait until the current menu returns before they try to create a new menu.

4. DspPopupMenu will take focus away from the Citect runtime, but no menu will display if there are no items in the main menu or its sub-menus. When the user clicks somewhere to change focus, DspPopupMenu will return -1.

5. There is a limit of 50 items per menu. This is the sum of the number of menu items and menu links shown together in one menu. Additional items will not be displayed.

6. The length of the [RUN] path (e.g. C:\Citect\User\MyProj) plus the length of the string passed to DspPopupMenu for the sMenuItems parameter must be <= 240. Otherwise the string will be truncated and "Too Long by x" will appear in the menu. It may be necessary to call DspPopupMenu multiple times to add items instead of adding them all in one call.