Button¶
Button is derived from Control class.
[lide.widgets] ^1.0lide.widgets.controls.button 1.0
A Button is a control that contains a text string, and is one of the most common elements of a GUI.
Constructor¶
Button class has a complex constructor:
object Button:new {
number ID, string Name,
object Parent, Text = 'My Button'
}
Events¶
The following events are emitted by this class:
| Event name | Description |
|---|---|
| Widget.onEnter | When the mouse moves onto this widget. |
| Widget.onLeave | When the mouse moves out to this widget. |
| Button.onClick | When the user clicks on this button. |
Inherited Methods¶
These methods are inherited from its super classes:
| Class Method | Description |
|---|---|
| Object:getID | Returns object’s identifier. |
| Object:setID | Sets the object identifier. |
| Object:getName | Returns object’s name. |
| Object:setName | Sets the object name. |
| Widget:getParent | Returns object’s parent. |
| Widget:setParent | Sets the object parent. |
| Widget:getPosX | Returns object’s position related to X. |
| Widget:setPosX | Sets the object position related to X. |
| Widget:getPosY | Returns object’s position related to Y. |
| Widget:setPosY | Sets the object position related to Y. |
| Widget:getWidth | Returns object’s width. |
| Widget:setWidth | Sets the object width. |
| Widget:getHeight | Returns object’s height. |
| Widget:setHeight | Sets the object height. |
| Widget:getBind | Returns the wxWidgets object. |
Button:getText¶
Returns the button’s text, as it was passed to
setText()Note that the returned string may contains mnemonics (“&” characters) if they were passed to the
setText()function; usegetText(false)if they are undesired.Also note that the returned string is always the string which was passed to
setText().Reimplemented from wxWindow.
Button:setText¶
Sets the control’s label.
All “&” characters in the label are special and indicate that the following character is a mnemonic for this control and can be used to activate it from the keyboard (typically by using Alt key in combination with it). To insert a literal ampersand character, you need to double it, i.e. use “&&”. If this behaviour is undesirable, use
setText(text, false)instead.