IUP - Portable User Interface


Creates an interface element that is a button. When selected, this element activates a function in the application. Its visual presentation can contain a text or an image.


Ihandle* IupButton(char *title, char *action); [in C]
iupbutton{title = title: string} -> elem: iuplua_tag [in IupLua3]
iup.button{title = title: string} -> elem: iuplua_tag [in IupLua5]
button(title, action) [in LED]

title: Text to be shown to the user.
action: Name of the action generated when the button is selected.

This function returns the identifier of the created button, or NULL (nil in IupLua) if an error occurs.


BGCOLOR: Background color of the text.

FGCOLOR: Text color.

FONT: Character font of the text.

IMAGE: Image of the non-pressed button. The button's title (attribute TITLE) is not shown when this attribute is defined.

IMPRESS: Image of the pressed button.

IMINACTIVE: Image of the button when the ACTIVE attribute equals "NO". If it is not defined but IMAGE is defined then for inactive buttons the non transparent colors will be replaced by a darker version of the background color creating the disabled effect.

SIZE: Size of the button. Default: smallest size that allows viewing the text or image.

TITLE: Text of the button.


Buttons with images or texts can not change its behavior after mapped. This is a creation attribute. But after creation the image can be changed for another image, and the text for another text.

Text and images are always centered.

Buttons are activated using Enter or Space keys.

When IMPRESS and IMAGE are defined together, IUP does not show the element's border to provide a 3D effect; the user has to define the border in the image itself.


ACTION: Action generated when the button is selected.

BUTTON_CB: Action generated when any mouse button is pressed or released.


See Also

IupImage, IupToggle.