IUP/Controls/IupButton: Difference between revisions

From Vendetta Lua
Jump to navigationJump to search
No edit summary
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:


===Creation===
===Creation===
 
    iup.button{title = '''title''': string} -> elem: ihandle
:iup.button{title = '''title''': string} -> elem: ihandle


:'''title''': Text to be shown to the user.
:'''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 nil if an error occurs.
:This function returns the identifier of the created button, or nil if an error occurs.
Line 28: Line 26:


:'''[[IUP/Attributes/Common/TITLE|TITLE]]''': Text of the button.
:'''[[IUP/Attributes/Common/TITLE|TITLE]]''': Text of the button.
===Callbacks===
:[[IUP/Callbacks/ACTION|ACTION]]: Action generated when the button 1 (usually left) is selected. This callback is called only after the mouse is released and whe it is released inside the button area.
:[[IUP/Callbacks/BUTTON_CB|BUTTON_CB]]: Action generated when any mouse button is pressed and released.
:[[IUP/Callbacks/ENTERWINDOW_CB|ENTERWINDOWS_CB]]: Action generated when the mouse enters the button.
:[[IUP/Callbacks/LEAVEWINDOW_CB|LEAVEWINDOW_CB]]: Action generated when the mouse leaves the button.
===Vendetta Online Templates===
    iup.stationbutton()


===Notes===
===Notes===
Line 40: Line 52:


:In Windows, when using Windows XP Visual Styles the BGCOLOR attribute is ignored when a non empty text button is created.
:In Windows, when using Windows XP Visual Styles the BGCOLOR attribute is ignored when a non empty text button is created.
===Callbacks===
:[[IUP/Callbacks/ACTION|ACTION]]: Action generated when the button 1 (usually left) is selected. This callback is called only after the mouse is released and whe it is released inside the button area.
:[[IUP/Callbacks/BUTTON_CB|BUTTON_CB]]: Action generated when any mouse button is pressed and released.
:[[IUP/Callbacks/ENTERWINDOW_CB|ENTERWINDOWS_CB]]: Action generated when the mouse enters the button.
:[[IUP/Callbacks/LEAVEWINDOW_CB|LEAVEWINDOW_CB]]: Action generated when the mouse leaves the button.


===See Also===
===See Also===


:[[IUP/Controls/IupImage|IupImage]], [[IUP/Controls/IupToggle|IupToggle]].
:[[IUP/Controls/IupImage|IupImage]], [[IUP/Controls/IupToggle|IupToggle]].
[[Category:IUP Controls]]

Latest revision as of 06:03, 11 May 2023


Controls

Dialog
Fill
Hbox
Vbox
Zbox
Cbox
Radio
Button
Canvas
Frame
Label
List
Multiline
Text
Toggle
Progress Bar
Matrix
Tree
Navmap

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.

Creation

   iup.button{title = title: string} -> elem: ihandle
title: Text to be shown to the user.
This function returns the identifier of the created button, or nil if an error occurs.

Attributes

BGCOLOR: Background color of the text.
FGCOLOR: Text color.
FONT: Font size 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.
TITLE: Text of the button.

Callbacks

ACTION: Action generated when the button 1 (usually left) is selected. This callback is called only after the mouse is released and whe it is released inside the button area.
BUTTON_CB: Action generated when any mouse button is pressed and released.
ENTERWINDOWS_CB: Action generated when the mouse enters the button.
LEAVEWINDOW_CB: Action generated when the mouse leaves the button.

Vendetta Online Templates

   iup.stationbutton()

Notes

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.
In Windows, when using Windows XP Visual Styles the BGCOLOR attribute is ignored when a non empty text button is created.

See Also

IupImage, IupToggle.