GMSwitchButton is an easy to use customisable button.
It allows to switch between multiple states, behaving like a looping counter.
It only responds to mouse down clicks, and does not discriminate button identifiers.
Creates a new instance of GMSwitchButton.
By default, its graphical properties are defined by its associated GMStyle.
a GMSwitchButton instance.
Sets or gets the Function to be triggered when the button is pressed down. This Function takes the current index of the button as argument, i.e. pressing it down from its first state to its second state will call the Function passing 1 as argument.
aFunction |
A Function with one argument, the current index of the button as an Integer. The case control structure allows to easily define what actions it should trigger (see example below). |
Sets or gets the Function to be triggered when the button is pressed down. This Function takes the current index of the button as argument, i.e. pressing it down from its first state to its second state will call the Function passing 1 as argument. Equivalent to .action
.
aFunction |
A Function with one argument, the current index of the button as an Integer. The case control structure allows to easily define what actions it should trigger (see example below). |
Sets or gets the View's states array, and refreshes the View. Resets the current index to 0.
anArray |
An Array containing an arbitrary number of IdentityDictionary, each containing at least a It is also possible to only provide an Array of strings. In this case, the GMStyle |
Sets or gets the View's current index, and refreshes the View. This doesn't trigger the associated action.
Frees every SVG, allowing garbage collection.
Sets or gets the font ratio relative to the widget size (depends on direction
).
Sets or gets the svg ratio relative to the widget size.
Sets or gets the string direction. Valid values are: \right
, \top
, \left
, \bottom
.
Sets every states background colors at once.
Sets every states font colors at once.
The function associated to the View's drawFunc
. Shouldn't be modified.
Assigning states without specifying colors :