Displaying pop-up menus

To display a pop-up menu in a window, use the PopMenu function to identify the menu and the location at which you want to display the menu.

If the menu is associated with the window

If the menu is currently associated with the window, you can simply call the PopMenu function.

The following statement in a CommandButton script displays m_appl.m_help as a pop-up menu at the current pointer position, assuming menu m_appl is already associated with the window:

m_appl.m_help.PopMenu(PointerX(), PointerY())

If the menu is not associated with the window

If the menu is not already associated with the window, you must create an instance of the menu before you can display it as a pop-up menu.

The following statements create an instance of the menu m_new, then pop up the menu mymenu.m_file at the pointer location, assuming m_new is not associated with the window containing the script:

m_new   mymenu
mymenu = create m_new
mymenu.m_file.PopMenu(PointerX(), PointerY())