qnx.fuse.ui.buttons.LabelButton

LabelButton

Properties | Methods | Examples


Packageqnx.fuse.ui.buttons
Classpublic class LabelButton
InheritanceLabelButton Inheritance Button Inheritance SkinnableComponent Inheritance UIComponent Inheritance flash.display.MovieClip
Subclasses BackButton, CheckBox, RadioButton

The LabelButton class allows you to add a label to your button.

A label button.



Class information:
PlayBook Tablet OS Version:   1.0.6

View the examples

See also

Button
IconButton



Public Properties

 PropertyDefined By
  embedFonts : Boolean
Gets or sets the embedFonts property of the internal TextField of the LabelButton.
LabelButton
 InheritedexplicitHeight : Number
[read-only] Returns the explicit height (actual height, in pixels) of the UI component.
UIComponent
 InheritedexplicitWidth : Number
[read-only] Returns the explicit width (actual width, in pixels) of the UI component.
UIComponent
 InheritedincludeInLayout : Boolean
Specifies whether or not the component should be included in its parent container's layout.
UIComponent
  label : String
Gets or sets the label for the button.
LabelButton
 InheritedlayoutData : Object
Returns the layout data for the object.
UIComponent
 InheritedminHeight : Number
Gets or sets the minimum preferred height of the control.
UIComponent
 InheritedminWidth : Number
Gets or sets the minimum preferred width of the control.
UIComponent
  paddingBottom : uint
Sets the number of extra pixels that are added on the bottom, between the text and the border of the button.
LabelButton
  paddingLeft : uint
Sets the number of extra pixels that are added on the left, between the border of the button and the text.
LabelButton
  paddingRight : uint
Sets the number of extra pixels that are added on the right, between the text and the border of the button.
LabelButton
  paddingTop : uint
Sets the number of extra pixels that are added on the top, between the border of the button and the text.
LabelButton
 Inheritedselected : Boolean
Gets or sets the selected property of the button.
Button
 Inheritedstate : String
Gets or sets the state of the component.
SkinnableComponent
 Inheritedtoggle : Boolean
Gets or sets the toggle property of the button.
Button
  truncationMode : String
Gets or sets the truncationMode of the button.
LabelButton

Public Methods

 MethodDefined By
  
Creates a new LabelButton instance.
LabelButton
 Inherited
childChanged(resizedChild:DisplayObject = null):Boolean
Notifies the UIComponent that one or more of its children has changed in a manner that may affect this object's layout.
UIComponent
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
Returns the size options for the given control.
UIComponent
  
getTextFormatForState(state:String):TextFormat
Returns the TextFormat object for a specified state.
LabelButton
 Inherited
Calling this method results in a call to the components validateDisplayList() method before the display list is rendered.
UIComponent
 Inherited
Calling this method results in a call to the components validateProperties() method before the display list is rendered.
UIComponent
 Inherited
measure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
This method calls doMeasure() in order to calculate the preferred size of the control.
UIComponent
 Inherited
setActualSize(w:Number, h:Number):void
Sets the width and height of the object without setting the explicitWidth and explicitHeight.
UIComponent
 Inherited
setLayoutBounds(bounds:Rectangle):void
Sets the receiver's size and location to the rectangular area specified by the arguments.
UIComponent
 Inherited
setPosition(x:Number, y:Number):void
Sets the x and y position of the component.
UIComponent
 Inherited
setSkin(newSkin:Object):void
Set the skin object on the component for it to render.
SkinnableComponent
  
setTextFormatForState(format:TextFormat, stateToModify:String):void
Sets the TextFormat object for the label for a given state.
LabelButton
 Inherited
Validates the display list of the component by calling the updateDisplayList().
UIComponent
 Inherited
Validates the component immediately by calling validateProperties(), validateSizes(), and validateDisplayList() if necessary.
UIComponent
 Inherited
Validates the properties of the component by calling the commitProperties() method.
UIComponent

Protected Methods

 MethodDefined By
 Inherited
Process properties of the component.
UIComponent
 Inherited
Process the state of the component.
UIComponent
 Inherited
doMeasure(availableWidth:Number, availableHeight:Number):LayoutMeasurement
Performs a measurement on the control, and returns a LayoutMeasurement instance containing the available width and height within the layout.
UIComponent
 Inherited
flushCache():void
Invoked as part of parentLayoutChanged.
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
Invalidates the parent's size and display list if includeInLayout property is set to true.
UIComponent
 Inherited
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Sets the size and position of the children of the component.
UIComponent
 Inherited
updateSkin(unscaledWidth:Number, unscaledHeight:Number):void
Updates the skin.
SkinnableComponent

Property Detail

embedFonts


embedFonts:Boolean

Gets or sets the embedFonts property of the internal TextField of the LabelButton.

When set to false, fonts are rendered as device fonts. When set to true, you must specify a font using the font property of a TextFormat object and set it using the setTextFormatForState() method.

This font must be included in your application. If it is not included, the text will not be rendererd.

The default value is false.


Implementation

public function get embedFonts():Boolean
public function set embedFonts(value:Boolean):void

See also

setTextFormatForState()

label


label:String

Gets or sets the label for the button.


Implementation

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

paddingBottom


paddingBottom:uint

Sets the number of extra pixels that are added on the bottom, between the text and the border of the button.

This affects the preferred size of the button and may be overridden by the layout.

The default value is 0.


Implementation

public function get paddingBottom():uint
public function set paddingBottom(value:uint):void

paddingLeft


paddingLeft:uint

Sets the number of extra pixels that are added on the left, between the border of the button and the text.

This affects the preferred size of the button and may be overridden by the layout.

The default value is 6.


Implementation

public function get paddingLeft():uint
public function set paddingLeft(value:uint):void

paddingRight


paddingRight:uint

Sets the number of extra pixels that are added on the right, between the text and the border of the button.

This affects the preferred size of the button and may be overridden by the layout.

The default value is 6.


Implementation

public function get paddingRight():uint
public function set paddingRight(value:uint):void

paddingTop


paddingTop:uint

Sets the number of extra pixels that are added on the top, between the border of the button and the text. This affects the preferred size of the button and may be overridden by the layout.

The default value is 0.


Implementation

public function get paddingTop():uint
public function set paddingTop(value:uint):void

truncationMode


truncationMode:String

Gets or sets the truncationMode of the button. The truncationMode value defines how the text label on the button will be treated when the label is too large to appear within the dimensions of the button. The label can be clipped, or truncated.

Valid values can be found in the TextTruncationMode class.

The default value is qnx.fuse.ui.text.TextTruncationMode.TRUNCATE_TAIL.


Implementation

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

See also

TextTruncationMode.TRUNCATE_TAIL

Constructor Detail

LabelButton()


public function LabelButton()

Creates a new LabelButton instance.

Method Detail

getTextFormatForState()


public function getTextFormatForState(state:String):TextFormat

Returns the TextFormat object for a specified state.

Parameters

state:String — The state for the TextFormat object to return. Valid states are:
  • SkinStates.UP
  • SkinStates.DOWN
  • SkinStates.SELECTED
  • SkinStates.DISABLED

Returns

TextFormat — The TextFormat object for the specified state.

See also

setTextFormatForState()
SkinStates

setTextFormatForState()


public function setTextFormatForState(format:TextFormat, stateToModify:String):void

Sets the TextFormat object for the label for a given state. Valid states are:

  • SkinStates.UP
  • SkinStates.DOWN
  • SkinStates.SELECTED
  • SkinStates.DISABLED

Parameters

format:TextFormat — The TextFormat to set.
stateToModify:String — The state for which to change the TextFormat.

See also

SkinStates
getTextFormatForState()

Examples

The following code listing describes how to modify the appearance of your button text for a given state. You can set separate text format objects for each button state. This enables your button text to change color, position, size, or font face whenever a user clicks a button, when a button is disabled, etc.

In this short example, two text format objects are created and associated with button states. The text format object formatDown is created and associated with the button.down state using the setTextFormatForState method. The formatDown object specifies the button label text as white.

package
     {
         import flash.display.Sprite;
         import flash.text.TextFormat;
         import flash.text.TextFormatAlign;
         import qnx.fuse.ui.buttons.LabelButton;
         import qnx.fuse.ui.skins.SkinStates;


         public class SkinSample extends Sprite
         {

             public function SkinSample()
             {
                 // create a text format for up, disabled, selected, etc.
                 // black label text
                 var format:TextFormat = new TextFormat();
                 format.font = "Myriad Pro";
                 format.size = 21;
                 format.color = 0x000000;
                 format.align = TextFormatAlign.CENTER;

                 // create a text format for the down state
                 // white label text
                 var formatDown:TextFormat = new TextFormat();
                 formatDown.font = "BBAlpha Sans";
                 format.size = 16;
                 formatDown.color = 0xFFFFFF;
                 formatDown.align = TextFormatAlign.CENTER;

                 var _button:LabelButton = new LabelButton();

                 // set the formats for each state you want to address
                 _button.setTextFormatForState(format,SkinStates.DISABLED);
                 _button.setTextFormatForState(format,SkinStates.UP);
                 _button.setTextFormatForState(formatDown,SkinStates.DOWN);
                 _button.setTextFormatForState(format,SkinStates.SELECTED);
                 _button.setTextFormatForState(format,SkinStates.DISABLED_SELECTED);

                 _button.label = "OK";
                 _button.x = _button.y = 175;

                 addChild(_button);
             }
         }
     }