A5ButtonToggle Class
Arguments
- settingsobject
The settings to use to create the button.
- statesarray
Button settings for each sate of a "multi-state" button list.
Description
Button toggle control.
Discussion
The button toggle control inherits from the button control, but adds a maintained statefulness to the button. There are two types of toggle buttons: "two-state" and "multi-state". A "two-state" toggle button uses a boolean to store the state. A "mutli-state" toggle button uses a number to store the state. An array of passed in button text and/or icons to represent the button in each state. These states are cycled through as the user presses the button.
Example
// assume that bEle is a pointer to an BUTTON element, and vEle is a VIDEO element var playButton = new A5.ButtonToggle({ theme: 'Alpha', layout: 'icon', onClick: function(btc,state){ if(state == 0) vEle.pause(); else vEle.play(); } },[ {icon: 'imgs/play.png'}, {icon: 'imgs/pause.png'} ]); playButton.bind(bEle);
Properties
- typestring
The type of toggle button. Values can be "two-state" (the default), or "multi-state".
- keepPressedboolean
If true (the default) then the button will retain a "pressed" look when selected.
- onClickfunction(button,state)
The code to execute when the button is clicked. The "this" variable of the function will be the BUTTON element.
- buttonobject
The button class.
- statebooleannumber
The state of the button.
Methods
- getValue Method
Get the value of some or all of the BUTTON elements bound to the A5.ButtonToggle control.
- setValue Method
Set the value on some or all of the BUTTON elements bound to the A5.ButtonToggle control.