NAME

IUP::Menu - [GUI element] menu which can group 3 types of elements: item, submenu, separator

DESCRIPTION

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 an error.

GTK Motif Windows Classic Windows w/ Style
RADIO=YES RADIO=YES RADIO=YES RADIO=YES

USAGE

CREATION - new() method

$menu = IUP::Menu->new(Ihandle *child, ...);
#standard way
my $menu = IUP::Menu->new( child=>[$elem1, $elem2], ANYATTRIBUTE=>'any value' );

#or with just a single child
my $menu = IUP::Menu->new( child=>$elem, ANYATTRIBUTE=>'any value' );

#or with just 1 parameter (arrayref)
my $menu = IUP::Menu->new( [$elem1, $elem2] );

#or with just 1 parameter (reference to child elements)
my $menu = IUP::Menu->new( $elem ); 

child: (named parameter) List of the references to elements (or just a single element) that will be grouped by the menu.

Returns: the identifier of the created element, or undef if an error occurs.

NOTE: You can pass to new() other ATTRIBUTE=>'value' or CALLBACKNAME=>\&func pairs relevant to this element - see IUP::Manual::02_Elements.

ATTRIBUTES

For more info about concept of attributes (setting/getting values etc.) see IUP::Manual::03_Attributes. Attributes specific to this element:

BGCOLOR

The background color of the menu, affects all items in the menu.

RADIO

(non inheritable) Enables the automatic toggle of one child item. When a child item is selected the other item is automatically deselected. The menu acts like a IUP::Radio for its children. Submenus and their children are not affected.

WID

(non inheritable) In Windows, returns the HMENU of the menu.

CALLBACKS

For more info about concept of callbacks (setting callback handlers etc.) see IUP::Manual::04_Callbacks. Callbacks specific to this element:

OPEN_CB

Called just before the menu is opened.

Called just after the menu is closed.

The following common callbacks are also accepted:

MAP_CB, UNMAP_CB

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 Popup function (usually on the mouse position) and disappears when an item is selected.

Destroy 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 Destroy. If you replace a menu bar of a dialog, the previous menu is unmapped.

Any item inside a menu bar can retrieve attributes from the dialog using GetAttribute. It is not necessary to call GetDialog.

The menu can be created with no elements and be dynamic filled using Append or Insert.

EXAMPLES

The element IUP::Menu is used in the following sample scripts:

SEE ALSO

IUP::Dialog, IUP::Item, IUP::Separator, IUP::Submenu, Popup, Destroy

The original doc: iupmenu.html