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

GMPlayButton
ExtensionExtension

A simple play/stop button for creating graphical interfaces

Description

GMPlayButton is an easy to use customisable button.

It natively alternates between two visual symbols related to the idea of playing and stopping a sound.

The second symbol can either be a symbol related to stopping a sound, or related to pausing a sound.

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

Class Methods

.new

Creates a new instance of GMPlayButton.

By default, its graphical properties are defined by its associated GMStyle. It uses both outlineColor and outlineSize properties.

Returns:

a GMPlayButton instance.

Instance Methods

.action

Sets or gets the Function to be triggered when the button is pressed down. This Function takes the current state of the button as a boolean as argument, i.e. pressing it down once will call the Function passing true as argument, pressing it down a second time will call the Function passing false as argument, etc.

Arguments:

aFunction

A Function with one argument, the state of the button as a Boolean.

.mouseDownAction

Sets or gets the Function to be triggered when the button is pressed down. This Function takes the current state of the button as a boolean as argument, i.e. pressing it down once will call the Function passing true as argument, pressing it down a second time will call the Function passing false as argument, etc. Equivalent to .action .

Arguments:

aFunction

A Function with one argument, the state of the button as a Boolean.

.toggle

Toggles the button, changing its state and evaluating the associated action.

.toggleDisplay

Toggles the button display, changing its state without evaluating the associated action.

Graphical settings

.mode

Sets or gets the type of symbol the second state displays. This is only a visual property.

Arguments:

aSymbol

The View second state will display two vertical bars if set as \pause, a square otherwise.

.symbolRatio

Sets or gets the symbol size relative to its smallest axis, and refreshes the View.

Internal Methods

.draw

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

Arguments:

aFunction

Examples