Please enable JavaScript to view this site.

AUI_MENU supports the creation of popup menus (aka "right-click" or "context" menus) for the main window and for dialogs. The syntax is the same the same as for the Traditional Method above, with the following differences:

There can be only one context menu for the main window and one for each dialog. When the menu is created, if there is a dialog active, then it becomes associated with the dialog; otherwise it becomes associated with the main window. As of A-Shell build 5.1.1151.0, the dlgid parameter may be specified to override the menu/dialog association rule just stated.
The menu ID of the context menu must be negative, although beyond that, the value is arbitrary and only serves to identify the menu. One way of assigning a unique value for each dialog would be to take the dialog's numeric ctlid, add 1, and negate it. (The offset of 1 would preserve the menu ID -1 for a menu attached to the main window, whose ctlid is effectively 0).
To add the clipboard operations Copy and Paste to the popup menu, use the MBF_CMDLIN format with the special commands "$COPY" and "$PASTE". $CUT doesn't really apply in this context.
Defining a context menu does not automatically change the cursor to an arrow, but you can do that with the AG_SETCURSOR;chr(32);chr(127); command and AG_SETCURSOR;chr(48);chr(127); to set it back to an I-beam.
You can delete the context menu with a single AUI_MENU call with opcode=MNUOP_DEL, mnutxt="*", and menuid set to the same value used when creating the menu.
The context menu will be active when the cursor is over the window or dialog, but not over a control which has its own click processing.
To display the menu under program control (rather than waiting for the user to right-click), use AUI_MENU with opcode=MNUOP_POP, e.g.

xcall AUI, AUI_MENU, MNUOP_POP, MENUID, "", ROW, COL, "", "", STATUS

 

The ROW and COL parameters mark the position of the upper left corner of the popup menu (relative to the current dialog, if applicable, or else to the main window), in (milli) row and column units and replace what would otherwise be the mstate and mtype parameters.

See Also

AUI_MENU can only add context menus to dialogs or the main window. To add context menus to other control types, see:

 

Created with Help+Manual 9 and styled with Premium Pack Version 5 © by EC Software