popup_menu

Manages floating popup menus.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X        

Syntax

void popup_menu(command[,data,...])
int             command
expr            data

Description

command specifies the action. Its value can be:

  • 0 --- Loads the popup menu from a list. In this case, data must be a list. Only the first column of the list is used and it must be char with one of the two following formats:
    < menu item label > is a simple popup menu where the list's sequence becomes the menu item ID.
    < ID > < level> < menu item label > is used for more complex popup menus where the main menu is level 0.
    The popup menu is displayed by either hitting the right mouse button in a non-child area of the window or by calling popup_menu(1). When an item is picked from the menu the pre-defined event trigger is invoked and the menu ID is placed in G.aux.
  • 1 --- Display the popup menu.
  • 2 --- Attach the popup menu to the windows menu bar. data must be a numeric expression indicating where to attach the popup menu. For example if this parameter is N, then the popup menu is attached to the Nth item on the window menu bar. N is zero based. When attached the popup menu is still available via the right mouse button or via popup_menu(1).
  • 3 --- Set popup menu item attribute. The parameters are pairs of ID and flags where flags (found in gui.h) are the same values as used when setting other fixed actions flags.
  • 4 --- Delete the popup menu.

Example

{
list LL;
list_mod(LL,1,"Item One");        /* Load the list                  */
list_mod(LL,1,"Item Two");
list_mod(LL,1,"Item Three");
popup_menu(popup_load,LL);        /* load the popup menu from list  */
popup_menu(popup_attach,3);       /* attach popup menu the 4th item */
                                  /* on the menu bar                */
popup_menu(popup_flag,0,
                 flag_tagged,     /* place check mark on "Item One" */
                 2,flag_disable); /* disable(gray) "Item Three"     */
}