Button

From TargetWiki

A Button is a type of widget. All widget functions can also be called on a button. Buttons are drawn on screen using a button style which is set in the current theme.

Each button can have it's own icon and text. It can also have both, or neither. Buttons default to gui.cangrow for their horizontal resize behaviour.

Since a button is a Lua object, calls should use the object:function() syntax. Also, all Lua object functions can also be called on a button.

Functions

icon()
This returns the texture that is displayed as an icon when this button is enabled.
seticon( <Texture> )
This sets the texture that is displayed as an icon when this button is enabled.
disabledicon()
This returns the texture that is displayed as an icon when this button is disabled.
setdisabledicon( <Texture> )
This sets the texture that is displayed as an icon when this button is disabled.
text()
This returns a string containing the the text displayed on the button.
settext( <string> )
This sets the the text displayed on the button.
toggle()
Returns true if this is a toggle button, false if this is a normal button. A toggle button changes between pressed and unpressed each time it is clicked, while a normal button is pressed while the mouse is down, but becomes unpressed when the mouse is release.
settoggle( <boolean> )
This function sets the buttons to act like a toggle if true, or a normal button if false.
pressed()
Returns the pressed state.
setpressed( <boolean> )
Sets the pressed state.
Views