View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
kmx > IUP-0.006 > IUP::Menu



Annotate this POD


New  2
Open  1
View/Report Bugs
Source   Latest Release: IUP-0.305


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


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.


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.


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


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


Called just before the menu is opened.


Called just after the menu is closed.

The following common callbacks are also accepted:


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.


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


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

The original doc: iupmenu.html

syntax highlighting: