IUP::Item - [GUI element] item of the menu interface element
Creates an item of the menu interface element. When selected, it generates an action.
$item = IUP::Item->new( TITLE=>"Item text" );
Returns: the identifier of the created element, or
undef if an error occurs.
NOTE: You can pass to
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:
Enables the automatic toggle of VALUE state when the item is activated. Default: NO.
[Motif and GTK Only]
If enabled the item cannot be checked, since the check box will not be shown. If all items in a menu enable it, then no empty space will be shown in front of the items. Normally the unmarked check box will not be shown, but since GTK 2.14 the unmarked check box is always shown. If your item will not be marked you must set HIDEMARK=YES, since this is the most common case we changed the default value to YES for this version of GTK, but if VALUE is defined the default goes back to NO. Default: NO.
[Windows and GTK Only] (non inheritable)
Image name of the check mark image when VALUE=OFF. In Windows, an item in a menu bar cannot have a check mark. Ignored if item in a menu bar. A recommended size would be 16x16 to fit the image in the menu item. In Windows, if larger than the check mark area it will be cropped.
[Windows and GTK Only] (non inheritable)
Image name of the check mark image when VALUE=ON.
Item text. The "&" character can be used to define a mnemonic, the next character will be used as key. Use "&&" to show the "&" character instead on defining a mnemonic. When in a menu bar an item that has a mnemonic can be activated from any control in the dialog using the "Alt+key" combination.
The text also accepts the control character '\t' to force text alignment to the right after this character. This is used to add shortcut keys to the menu, aligned to the right, ex: "Save\tCtrl+S", but notice that the shortcut key (also known as Accelerator or Hot Key) still has to be implemented. To implement a shortcut use the K_* callbacks in the dialog.
Image name of the title image. In Windows, it appears before of the title text and after the check mark area (so both title and title image can be visible). In Motif, it must be at least defined during map, it replaces the text, and only images will be possible to set (TITLE will be hidden). In GTK, it will appear on the check mark area.
Indicates the item's state. When the value is ON, a mark will be displayed to the left of the item. Default: OFF. An item in a menu bar cannot have a check mark. When IMAGE is used, the checkmark is not shown. See the item AUTOTOGGLE attribute and the menu =item RADIO attribute.
WID (non inheritable)
In Windows, returns the HMENU of the parent menu.
The following common attributes are also accepted:
For more info about concept of callbacks (setting callback handlers etc.) see IUP::Manual::04_Callbacks. Callbacks specific to this element:
Action generated when the item is selected. IUP_CLOSE will be processed. Even if inside a popup menu when IUP_CLOSE is returned, the current popup dialog or the main loop will be closed.
Action generated when the item is highlighted.
The following common callbacks are also accepted:
Menu items are activated using the Enter key.
In Motif and GTK, the text font will be affected by the dialog font when the menu is mapped.
Since GTK 2.14 to have a menu item that can be marked you must set the VALUE attribute to ON or OFF, or set HIDEMARK=NO, before mapping the control.
The element IUP::Item is used in the following sample scripts:
0-basic/dialog2.pl - IUP::Dialog example
0-basic/item.pl - IUP::Item Example
0-basic/layoutdialog.pl - IUP::LayoutDialog example
0-basic/menu.pl - IUP::Menu example
0-basic/separator.pl - IUP::Separator example
0-basic/submenu.pl - IUP::Submenu example
0-basic/tray.pl - IUP::Dialog + TRAY / TRAYTIP / TRAYIMAGE example
1-apps/app-mdi.pl - IUP app example
1-apps/app-sample1.pl - example used for screenshot - IUP.pod
1-apps/app-sample2.pl - example based on the original sample.c
1-apps/app-simple-demo.pl - example used for screenshot - IUP.pod
The original doc: iupitem.html