| Package | qnx.ui.buttons |
| Class | public class CheckBox |
| Inheritance | CheckBox LabelButton Button SkinnableComponent UIComponent flash.display.MovieClip |
CheckBox class is a simple subclass of the LabelButton class. The CheckBox class provides simple binary check box
functionality for your application. The CheckBox
class has its toggle property set to true. This property cannot be changed.
You can adjust the position of the text relative to the check box by setting the labelPlacement property.
See also
| Property | Defined By | ||
|---|---|---|---|
![]() | containment : String
Gets or sets a property that determines how a component is contained within a parent container. | UIComponent | |
![]() | embedFonts : Boolean
Gets or sets the embedFonts property of the internal TextField of the LabelButton. | LabelButton | |
![]() | label : String
Gets or sets the label for the button. | LabelButton | |
| labelPadding : int
Gets or sets a value that determines the padding between the label and the skin/icon (in pixels). | CheckBox | ||
| labelPlacement : String
Gets or sets the placement of the label according to the skin. | CheckBox | ||
![]() | selected : Boolean
Gets or sets the selected property of the button. | Button | |
![]() | size : Number
Gets or sets the size for this component (as a percentage of the
container's size, or in pixels). | UIComponent | |
![]() | sizeMode : String
Gets or sets the size mode for this component. | UIComponent | |
![]() | sizeUnit : String
Gets or sets the unit of measure for the size property. | UIComponent | |
![]() | toggle : Boolean
Gets or sets the toggle property of the button. | Button | |
![]() | truncationMode : String
Gets or sets the truncationMode of the button. | LabelButton | |
| Method | Defined By | ||
|---|---|---|---|
CheckBox()
Creates a new CheckBox instance. | CheckBox | ||
![]() | destroy():void
Call this method when you want to have your object collected by the garbage collector. | UIComponent | |
![]() | drawNow():void
Calls the draw() method. | UIComponent | |
![]() | getTextFormatForState(state:String):TextFormat
Returns the TextFormat object for a specified state. | LabelButton | |
![]() | invalidate(property:String, invalidateNow:Boolean = false):void
Marks the property as invalid and the draw() method is called on the next frame or the next render, whichever comes first. | UIComponent | |
![]() | setPosition(x:Number, y:Number):void
Sets the x and y position of the component. | UIComponent | |
![]() | setSize(w:Number, h:Number):void
Sets the width and height of the component. | UIComponent | |
![]() | setSkin(cellSkin:Object):void
Set the skin object on the component for it to render. | SkinnableComponent | |
![]() | setTextFormatForState(format:TextFormat, state:String):void
Sets the TextFormat object for the label for a given state. | LabelButton | |
| labelPadding | property |
labelPadding:intGets or sets a value that determines the padding between the label and the skin/icon (in pixels).
The default value is 0.
public function get labelPadding():int public function set labelPadding(value:int):void| labelPlacement | property |
labelPlacement:StringGets or sets the placement of the label according to the skin.
Can be one of:
LabelPlacement.RIGHTLabelPlacement.LEFTLabelPlacement.TOPLabelPlacement.BOTTOM The default value is .LabelPlacement.RIGHT
public function get labelPlacement():String public function set labelPlacement(value:String):voidSee also
| CheckBox | () | Constructor |
public function CheckBox()
Creates a new CheckBox instance.
In the following example, a CheckBox is used to disable a set of controls.
package
{
import flash.display.Sprite;
import flash.events.MouseEvent;
import qnx.ui.buttons.CheckBox;
import qnx.ui.buttons.LabelButton;
import qnx.ui.text.TextInput;
[SWF(height="600", width="1024", frameRate="30",
backgroundColor="#FFFFFF")]
public class checkBoxSample extends Sprite
{
private var myCheckBox:CheckBox;
private var myButton:LabelButton;
private var myText:TextInput;
public function checkBoxSample()
{
initializeUI();
}
private function initializeUI():void
{
myCheckBox = new CheckBox();
myCheckBox.setPosition(175, 350);
myCheckBox.width = 200;
myCheckBox.label = "Disable login";
myCheckBox.labelPadding = 5;
myCheckBox.addEventListener(MouseEvent.CLICK, disableButton);
this.addChild(myCheckBox);
myButton = new LabelButton();
myButton.setPosition(175, 300);
myButton.width = 100;
myButton.label = "Login";
this.addChild(myButton);
myText = new TextInput();
myText.setPosition(175, 250);
myText.width = 150;
this.addChild(myText);
}
private function disableButton(e:MouseEvent):void
{
myButton.enabled = !myButton.enabled;
myText.enabled = !myText.enabled;
}
}
}