qnx.ui.buttons.CheckBox

CheckBox

Properties | Methods | Examples


Packageqnx.ui.buttons
Classpublic class CheckBox
InheritanceCheckBox Inheritance LabelButton Inheritance Button Inheritance SkinnableComponent Inheritance UIComponent Inheritance flash.display.MovieClip

The 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.

A check box.

You can adjust the position of the text relative to the check box by setting the labelPlacement property.



Class information:
PlayBook Tablet OS Version:   1.0.6

View the examples

See also

Button
ToggleSwitch



Public Properties

 PropertyDefined By
 Inheritedcontainment : String
Gets or sets a property that determines how a component is contained within a parent container.
UIComponent
 InheritedembedFonts : Boolean
Gets or sets the embedFonts property of the internal TextField of the LabelButton.
LabelButton
 Inheritedlabel : 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
 Inheritedselected : Boolean
Gets or sets the selected property of the button.
Button
 Inheritedsize : Number
Gets or sets the size for this component (as a percentage of the container's size, or in pixels).
UIComponent
 InheritedsizeMode : String
Gets or sets the size mode for this component.
UIComponent
 InheritedsizeUnit : String
Gets or sets the unit of measure for the size property.
UIComponent
 Inheritedtoggle : Boolean
Gets or sets the toggle property of the button.
Button
 InheritedtruncationMode : String
Gets or sets the truncationMode of the button.
LabelButton

Public Methods

 MethodDefined By
  
Creates a new CheckBox instance.
CheckBox
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
drawNow():void
Calls the draw() method.
UIComponent
 Inherited
getTextFormatForState(state:String):TextFormat
Returns the TextFormat object for a specified state.
LabelButton
 Inherited
invalidate(property:String = all, 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
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
 Inherited
setSize(w:Number, h:Number):void
Sets the width and height of the component.
UIComponent
 Inherited
setSkin(cellSkin:Object):void
Set the skin object on the component for it to render.
SkinnableComponent
 Inherited
setTextFormatForState(format:TextFormat, state:String):void
Sets the TextFormat object for the label for a given state.
LabelButton

Protected Methods

 MethodDefined By
 Inherited
callLater(method:Function):void
Calls the specified method on the next frame or the next render, which ever happens first.
UIComponent
 Inherited
createInstance(linkage:Object):DisplayObject
Calling this method will attempt to create a DisplayObject instance based on the value of the linkage parameter.
UIComponent
 Inherited
draw():void
Called every time you set the width and height of the component.
UIComponent
 Inherited
isInvalid(property:String, ... properties):Boolean
Checks to see if the property is invalid and returns true if it is.
UIComponent
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
onRemoved():void
Called when the instance is removed from the stage.
UIComponent
 Inherited
setEnabled(val:Boolean):void
Called when the enabled property changes.
UIComponent
 Inherited
validate(property:String = all):void
Lets the component know that the specified property has been validated.
UIComponent

Property Detail

labelPadding


labelPadding:int

Gets or sets a value that determines the padding between the label and the skin/icon (in pixels).

The default value is 0.


Implementation

public function get labelPadding():int
public function set labelPadding(value:int):void

labelPlacement


labelPlacement:String

Gets or sets the placement of the label according to the skin.

Can be one of:

  • LabelPlacement.RIGHT
  • LabelPlacement.LEFT
  • LabelPlacement.TOP
  • LabelPlacement.BOTTOM

The default value is LabelPlacement.RIGHT.


Implementation

public function get labelPlacement():String
public function set labelPlacement(value:String):void

See also

LabelPlacement

Constructor Detail

CheckBox()


public function CheckBox()

Creates a new CheckBox instance.

Examples

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;
            
        }
    }
}