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

GMFeedbackButton
ExtensionExtension

A simple button with a visual feedback effect for creating graphical interfaces

Description

GMFeedbackButton is an easy to use customisable button with a visual feedback.

On press, its color switches from a second state back to its default state within a defined period of time.

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

NOTE: Since the .frameRate method inherited from the UserView class is unreliable, the frame rate of this UserView is hardcoded at 60 fps, and changing it will desynchronize the blinkTime value.

Class Methods

.new

Creates a new instance of GMFeedbackButton.

Its graphical properties are defined by its associated GMStyle.

Both the blink color and the font blink color must be set explicitly.

Returns:

a GMFeedbackButton instance.

Instance Methods

Interaction

.action

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

Arguments:

aFunction

A Function without argument.

.mouseDownAction

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

Arguments:

aFunction

A Function without argument.

Graphical settings

.blinkColor

Sets or gets the widget back color when it's starting its visual effect.

.blinkFontColor

Sets or gets the widget font color when it's starting its visual effect.

.blinkTime

Sets or gets the time in seconds it takes for the View's to complete its visual effect.

Arguments:

aNumber

A Float value, in seconds.

.string

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

.stringRatio

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.

.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