IupMenu
Creates a menu element, which groups 3 types of interface elements: item, submenu and separator. Any other interface element defined inside a menu will be ignored.
Creation
Ihandle* IupMenu(Ihandle *child, ...); [in C] Ihandle* IupMenuv(Ihandle **children); [in C] iup.menu{child, ...: ihandle} -> (elem: ihandle) [in Lua] menu(child, ...) [in LED]
child, ... : List of identifiers that will be grouped by the menu. NULL must be used to mark the end of the list in C. It can be empty.
Returns: the identifier of the created element, or NULL if an error occurs.
Callbacks
OPEN_CB: Called just before a submenu is opened.
MENUCLOSE_CB: Called right before the submenu is closed.
Notes
A menu can be a menu bar of a dialog, defined by the dialog's MENU attribute, or a popup menu.
A popup menu is displayed for the user using the IupPopup function (usually on the mouse position) and disappears when an item is selected.
IupDestroy should be called only for popup menus. Menu bars associated with dialogs are automatically destroyed when the dialog is destroyed. But if you change the menu of a dialog for another menu, the previous one should be destroyed using IupDestroy.
In Motif the menu does not inherit attributes from the dialog, like in the Windows driver. This should be solved in future versions.
Lua Binding
Offers a "cleaner" syntax than LED for defining menu, submenu and separator items. The list of elements in the menu is described as a string, with one element after the other, separated by commas.
Each element can be:
{"<item_name>"} - menu item
{"<submenu_name>","<menu>"} - submenu
{} - separator
For example:
mnu = iup.menu { iup.submenu { iup.menu { iup.item{title="IupItem 1 Checked",value="ON"}, iup.separator{}, iup.item{title="IupItem 2 Disabled",active="NO"} } ;title="IupSubMenu 1" }, iup.item{title="IupItem 3"}, iup.item{title="IupItem 4"} }
The same example using the cleaner syntax:
mnu = iup.menu { { "IupSubMenu 1", iup.menu { {"IupItem 1 Checked";value="ON"}, {}, {"IupItem 2 Disabled";active="NO"} } }, {"IupItem 3"}, {"IupItem 4"} }