Pop-up Menus
A Pop-up Menu
This section covers the following topics:
Aligning Item Labels in a Pop-up Menu
The middle image represents a pop-up menu for which the default alignment mode has been deactivated and no specific label offset has been defined. The rightmost image shows a pop-up menu aligned with a label offset of 40 pixels.
Using Tear-Off Menus
A pop-up menu
A Tear-Off Menu
You can tear off a pop-up menu by selecting its first item. The first item of a tear-off menu must be of the type IlvTearOffItem. To set a menu item as a tear-off item, use
Using the Open Menu Callback
You can set an Open Menu callback with the
Using Checked Menu Items
A Checked Menu Item
The best place to set a check mark for a menu item is the Open Menu callback. That way the check mark is always correct when the menu is opened. See Using the Open Menu Callback.
The check mark does not automatically disappear when you select a checked item, you must uncheck the item when necessary. To set a check mark for a menu item, use the member
Using Stand-alone Menus
A Contextual Menu
To use a pop-up menu as a stand-alone menu, use
When the user chooses an item from a contextual menu, the member function doIt is called.
A contextual menu cannot be a submenu.
Using Tooltips in a Pop-Up Menu
The menu items in a pop-up menu can be associated with a tooltip. A tooltip is short explanatory text that is displayed when the user places the mouse over its associated menu item.
To set a tooltip for a menu item, use setToolTip. To disable tooltips, call useToolTips with its parameter set to IlFalse.