insertMenuItem

Syntax

int insertMenuItem (int hMenu, int uItem, LPSTR itemName, int fState, int subMenu)

Arguments

hMenu
Handle to the menu in which the new menu item is inserted.
uItem
Unique identifier of the menu item. Must not be 0 or order may be changed.
itemName
Menu item string. If itemName is "---", a horizontal line will be appear.
fState
Menu item state, e.g. MFS_CHECKED, MFS_DEFAULT, MFS_DISABLED, MFS_ENABLED, MFS_GRAYED, MFS_HILITE, MFS_UNCHECKED, MFS_UNHILITE.
subMenu
Handle to the submenu associated with the menu item. If the menu item is not an item that opens a submenu, please use 0.

Return

Returns true if succeeded.

Description

Inserts a new menu item into the given menu.

Comment

Menu items appear in the same order as the order of insertMenuItem() calls.

Example

%ffp

ctl[0]: PUSHBUTTON, "Click Me!"

OnCtl(n): {

  if (n==0 && e == FME_CLICKED){
    int menu=0;

    menu = createPopupMenu();

    insertMenuItem(menu, 1, "Do This",MFS_ENABLED , NULL);
    insertMenuItem(menu, 2, "Do That",MFS_ENABLED | MFS_DEFAULT, NULL);
    insertMenuItem(menu, 3, "Do Nothing",MFS_ENABLED, NULL);
    Info("Selection: %d", trackPopupMenu (menu, 1, 0,0,0) );

    destroyMenu(menu);
  }

  return false;
}

See Also

createPopupMenu, trackPopupMenu, destroyMenu