RadioGroup
Kind of class: | public class |
---|---|
Package: | |
Inherits from: |
|
Implements: | |
Classpath: | org.asaplibrary.ui.form.components.RadioGroup |
File last modified: | Friday, 13 May 2011, 22:20:35 |
Class for implementing radio button groups.
Example
-
Assume 3 objects of type SimpleCheckBox are placed on the stage, with instance names "tRadio1", "tRadio2", "tRadio3"
// create new group, add radio buttons, select first button, listen to change event var rg:RadioGroup = new RadioGroup(); rg.addButton(tRadio1, "1"); rg.addButton(tRadio2, "2"); rg.addButton(tRadio3, "3"); rg.selectButton(tRadio1); rg.addEventListener(Event.CHANGE, handleRadioGroupChanged); // create validator, add group for not null validation mValidator = new Validator(); mValidator.addValidationRule(new NullValidationRule(rg));
To get the currently selected button, use this:var currentButton:SimpleCheckBox = rg.getSelection() as SimpleCheckBox;
To get the value of the currently selected button, use this:var value:* = rg.getValue();
Summary
Instance methods
-
addButton
(inButton:ISelectable, inValue = *) : void
- Add a button to the group
-
selectButton
(inButton:ISelectable) : void
- Select the specified button (can be null to deselect current selection)
-
getSelection
() : ISelectable
- Return the currently selected button
- getButtons () : Array
-
getValue
() : *
Instance methods
getButtons
function getButtons() : Array
Returns
- all buttons in this group; objects of type ISelectable
getValue
function getValue() : *
Return the value to be validated
It is expected that the IValidationRule implementation that validates this, knows what to cast the value to →
Returns
- the value of the currently selected button as provided during addition; returns null if no button is selected.
hideError
function hideError() : void
Hide the error state
reset
function reset() : void
Reset the group by calling reset on all buttons if they implement IResettable, or deselecting & enabling them
selectButton
function selectButton(inButton:ISelectable) : void
Select the specified button (can be null to deselect current selection)
showError
function showError() : void
Show the error state
toString
override function toString() : String
Overrides
- EventDispatcher.toString