Applies To:
  • CitectSCADA 5.42r0
  • CitectHMI 5.42r0

Summary:
The Citect Help does not cite an example on how to pass Variable Tags or Cicode Variables to the sMenuItems argument when calling the Cicode DspPopupMenu command in Citect. I can only get the menu items to display when I hard-code the string menu items. For example:

FUNCTION DspMyMenu()

    INT iSelection;

    DspPopupMenu(0, "MenuItem1,MenuItem2,MenuItem3");
    iSelection = DspPopupMenu();
END

How can one pass Variable Tags or Cicode Variables as one string for the sMenuItems parameter?

 

Solution:
The following is an example of how to do this using Cicode Variables, which must be initialized after declaring the function:

FUNCTION DspMyMenu()

INT iSelection;
STRING sItem1 = "Andromeda";
STRING sItem2 = "Orion";
STRING sItem3 = "Ursa Major";
STRING sItem4 = "Bellatrix";
STRING sItem5 = "Betelgeuse";
STRING sItem6 = "Rigel";
STRING sItem7 = "Saiph";

! menu item 2 references submenu 1 (linked menu)
DspPopupMenu(0, sItem1 + "," + sItem2 + ">1" + "," + sItem3);
! submenu items
DspPopupMenu(1, sItem4 + "," + sItem5 + "," + sItem6 + "," + sItem7);
iSelection = DspPopupMenu();

END

To accomplish the same thing using Variable Tags (disk, memory or external / PLC), you use the same syntax (above) when calling DspPopupMenu while leaving out the variable declarations (preceding it). You will still need to assign string values to each of the tags being used as menu items (i.e. by means of a command button, startup function, etc.).

 

Keywords:
 

Attachments