IupItem

IUP - Portable User Interface

IupItem

Creates an item of the menu interface element. When selected, it generates an action.

Creation

Ihandle* IupItem(const char *title, const char *action); [in C]
iup.item{[title = title: string]} -> elem: ihandle [in Lua]
item(title, action) [in LED]

title: Text to be shown on the item. It can be NULL. It will set the TITLE attribute.
action: Name of the action generated when the item is selected. It can be NULL.

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

Attributes

KEY: Associates a key to the item. The key will be used when navigating in the parent menu that contains the item. If the same character key is present in the title, then it will be underlined.

VALUE: Indicates the item's state. When the value is ON, a mark will be displayed to the left of the item. Default: OFF.

TITLE: Text shown to the user. It is possible to change its value on-the-fly.

IMAGE: (Windows Only) Image of the non-checked menu item. The size should be are 16x16.

IMPRESS: (Windows Only) Image of the checked menu item.

Callbacks

ACTION: Action generated when the item is selected.

HIGHLIGHT_CB: Action generated when the item is highlighted.

Notes

The text of the menu item 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".

In WIndows, you can also underline a key using the prefix "&" just before the Key.

Menu items are activated using the Enter key.

Attention: Never use the same menu item in different menus.

Examples

Browse Example Files

See Also

IupSeparator, IupSubmenu, IupMenu.