trackPopupMenu

Syntax

int fm_trackPopupMenu (int hMenu, int type, int x, int y, int style)

Arguments

hMenu
Handle to the menu to be displayed.
type
If set to 1, the popup menu is displayed at the cursor coordinates. Otherwise it is displayed at the x,y coordinates.
x, y
Coordinates of the popup menu in DBU. Supply only if type != 1.
style
A few alignment and other options, e.g. TPM_HORIZONTAL, TPM_VERTICAL, TPM_CENTERALIGN, TPM_LEFTALIGN, TPM_RIGHTALIGN, TPM_BOTTOMALIGN, TPM_TOPALIGN, TPM_VCENTERALIGN, TPM_NONOTIFY, TPM_RETURNCMD, TPM_LEFTBUTTON, TPM_RIGHTBUTTON. Set it to zero for default behaviour.

Return

Returns the number of the menu item (uItem) that was selected by the user (but only if you use 0 or TPM_RETURNCMD or the style parameter). If no menu item was selected, zero is returned.

Description

Queries a menu for the last selected item by the user.

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, insertMenuItem, destroyMenu