GMButton:
Filter:
GraphicalModule/Classes (extension) | GUI > Graphical Module

GMButton
ExtensionExtension

A simple button for creating graphical interfaces

Description

GMButton is an easy to use customisable button.

It responds to mouse down and up clicks, but does not discriminate button identifiers.

Class Methods

.new

Creates a new instance of GMButton.

Its graphical properties are defined by its associated GMStyle.

Returns:

a GMButton instance.

Instance Methods

Interaction

.mouseDownAction

Sets or gets the Function to be triggered when the button is pressed down. This Function doesn't take arguments.

Arguments:

aFunction

A Function without argument.

.mouseUpAction

Sets or gets the Function to be triggered when the button has been pressed, and is released. This Function doesn't take arguments.

Arguments:

aFunction

A Function without argument.

.action

Sets or gets the Function to be triggered when the button is pressed down. Doesn't take arguments. Equivalent to .mouseDownAction .

Arguments:

aFunction

A Function without argument.

Graphical settings

.string

Sets or gets the button displayed text, and refreshes the View.

.stringRatio

Deprecated, see fontRatio

.fontRatio

Sets or gets the widget displayed text ratio, relative to the smallest axis of the widget, and refreshes the View. You'll need to reduce this value if the displayed text is larger than the size of the widget.

.maxFontSize

Sets or gets the maximum allowed font size.

.orientation

Sets or gets the button displayed text orientation, and refreshes the View. Valid values are : \right, \top, \left or \bottom. This doesn't affect the displayed svg if any.

.svg

Sets or gets the button displayed svg, and refreshes the View. Takes a String indicating the path to the svg file as argument.

.svgRatio

Sets or gets the widget displayed svg ratio, relative to the smallest axis of the widget, and refreshes the View.

.free

Removes the svg and frees its ressources. Refreshes the View.

Internal Methods

.draw

The function associated to the View's drawFunc. Shouldn't be modified.

.resizeSVG

The function that rescales the svg when needed.

Examples