qnx.fuse.ui.text.TextBase

TextBase

Properties | Methods | Events


Packageqnx.fuse.ui.text
Classpublic class TextBase
InheritanceTextBase Inheritance UIComponent Inheritance flash.display.MovieClip
Subclasses EditableText

The TextBase class provides base functionality for rendering and selecting text.

Class information:
PlayBook Tablet OS Version:   1.0.6

See also

EditableText



Public Properties

 PropertyDefined By
 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
  format : TextFormat
Gets or sets the format of the text.
TextBase
 InheritedincludeInLayout : Boolean
Specifies whether or not the component should be included in its parent container's layout.
UIComponent
 InheritedlayoutData : Object
Returns the layout data for the object.
UIComponent
  length : int
[read-only] Returns the length of the text that is being rendered.
TextBase
  locale : String
Gets or sets the current locale of the text.
TextBase
  maxLines : int
Gets or sets the maximum number of lines to be measured by a layout.
TextBase
 InheritedminHeight : Number
Gets or sets the minimum preferred height of the control.
UIComponent
  minLines : int
Gets or sets the minimum number of lines to be measured by a layout.
TextBase
 InheritedminWidth : Number
Gets or sets the minimum preferred width of the control.
UIComponent
  selectable : Boolean
Gets or sets a value that determines whether text can be selected.
TextBase
  selected : Boolean
[read-only] Returns true if the component has a text selection and false if it does not.
TextBase
  selectionActiveIndex : int
[read-only] Returns the zero-based index of the first character in the selection.
TextBase
  selectionAnchorIndex : int
[read-only] Returns the zero-based index of the last character in the selection.
TextBase
  text : String
Gets or sets the text of the component.
TextBase
  textHeight : Number
[read-only] Gets the current height of the text.
TextBase
  textWidth : Number
[read-only] Gets the current width of the text.
TextBase

Protected Properties

 PropertyDefined By
  enableEmoticons : Boolean
Gets or sets a value that enables or disables emoticons from being displayed.
TextBase

Public Methods

 MethodDefined By
  
Do not instantiate this class.
TextBase
 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
  
getTextLineAt(index:int):TextLine
Gets a TextLine instance at a specific index.
TextBase
 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
  
mouseFocusChange(event:FocusEvent):void
Checks to see if focus is about to be lost when interacting with an object in the control.
TextBase
  
registerEmoticons(emoticons:Vector.<Emoticon>):void
Registers a set of emoticons with the text component.
TextBase
  
scrollInView(position:int, immediate:Boolean = false):void
Scrolls the position into view.
TextBase
 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
  
setSelection(anchorIndex:int, activeIndex:int):void
Sets the range of selected text.
TextBase
 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
  
composeLines(width:Number, height:Number):Boolean
Creates all TextLine instances given the specified width and height.
TextBase
  
createTextLines(width:Number, height:Number):void
Renders the text at the specified width and height.
TextBase
  
cursor2linePos(cursor:Cursor, consumer:Function):void
Given a specified cursor, this method calls the consumer parameter with TextLine and the x position of the cursor.
TextBase
 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
  
event2cursor(stageX:Number, stageY:Number, rail:TextLine):Cursor
Gets a cursor given x and y cordinates of the component, expressed in the stage corrdinate system.
TextBase
  
event2word(stageX:Number, stageY:Number, consumer:Function):void
Based on x and y positions in the stage corrdinate system, call the consumer with the logical start and end of the word in the text.
TextBase
 Inherited
flushCache():void
Invoked as part of parentLayoutChanged.
UIComponent
  
Gets the text alignment for laying out the text.
TextBase
  
Gets the text to be rendered by the component.
TextBase
 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
  
position2cursor(position:int):Cursor
Return a Cursor object given the specified position in the text.
TextBase
  
positionLines(width:Number, height:Number, lines:Vector.<TextLine>):Point
Positions all of the created text lines given a specified width and height.
TextBase
  
Removes the current TextLine instances from the display list.
TextBase
  
Called when the text is moving during a scroll.
TextBase
 Inherited
updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
Sets the size and position of the children of the component.
UIComponent

Events

 Event Summary Defined By
   This event is fired when the dimensions of the text have changed.TextBase
   This event is fired when a selection change on the component occurs.TextBase

Property Detail

enableEmoticons


enableEmoticons:Boolean

Gets or sets a value that enables or disables emoticons from being displayed.

This is set by the registerEmoticons() method. Passing in a Vector with a length bigger then 0 will set this property to true. Otherwise it is set to false.


Implementation

protected function get enableEmoticons():Boolean
protected function set enableEmoticons(value:Boolean):void

format


format:TextFormat

Gets or sets the format of the text.


Implementation

public function get format():TextFormat
public function set format(value:TextFormat):void

length


length:int  [read-only]

Returns the length of the text that is being rendered.

This may be different than calling text.length(); Emoticons in the text count as 1 character.


Implementation

public function get length():int

locale


locale:String

Gets or sets the current locale of the text.

The locale property controls whether text is rendered left to right or right to left.

The default value is en_US.


Implementation

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

maxLines


maxLines:int

Gets or sets the maximum number of lines to be measured by a layout.

The text component will render additional lines, if necessary, and will be clipped from view. Setting this value to 0 causes all lines to be measured.

The default value is 0.


Implementation

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

minLines


minLines:int

Gets or sets the minimum number of lines to be measured by a layout.

If the full text results in less lines than the minimum number of lines, then the size of the minimum number of lines will be returned when measuring the text. Setting this value less then 1 will have no effect and will be constrained to 1.

The default value is 1.


Implementation

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

selectable


selectable:Boolean

Gets or sets a value that determines whether text can be selected.

The default value is true.


Implementation

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

selected


selected:Boolean  [read-only]

Returns true if the component has a text selection and false if it does not.


Implementation

public function get selected():Boolean

selectionActiveIndex


selectionActiveIndex:int  [read-only]

Returns the zero-based index of the first character in the selection.


Implementation

public function get selectionActiveIndex():int

See also

selectionAnchorIndex

selectionAnchorIndex


selectionAnchorIndex:int  [read-only]

Returns the zero-based index of the last character in the selection.


Implementation

public function get selectionAnchorIndex():int

See also

selectionActiveIndex

text


text:String

Gets or sets the text of the component.


Implementation

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

textHeight


textHeight:Number  [read-only]

Gets the current height of the text.


Implementation

public function get textHeight():Number

textWidth


textWidth:Number  [read-only]

Gets the current width of the text.


Implementation

public function get textWidth():Number

urlBarMode


urlBarMode:Boolean


Implementation

qnx_internal function get urlBarMode():Boolean
qnx_internal function set urlBarMode(value:Boolean):void

Constructor Detail

TextBase()


public function TextBase()

Do not instantiate this class.

Method Detail

composeLines()


protected function composeLines(width:Number, height:Number):Boolean

Creates all TextLine instances given the specified width and height.

This method adds the text lines to the display list of the textHolder property and to the textLines vector. Overriding this method and failing to do either of these items will cause undesired behavior.

Parameters

width:Number
height:Number

Returns

Boolean — Returns true if all of the text lines were created.

createTextLines()


protected final function createTextLines(width:Number, height:Number):void

Renders the text at the specified width and height.

Parameters

width:Number — The available width to render text into.
height:Number — The available height to render text into.

cursor2linePos()


protected final function cursor2linePos(cursor:Cursor, consumer:Function):void

Given a specified cursor, this method calls the consumer parameter with TextLine and the x position of the cursor. The consumer function should be the following. function( line:TextLine, x:Number ):void

Parameters

cursor:Cursor
consumer:Function

event2cursor()


protected final function event2cursor(stageX:Number, stageY:Number, rail:TextLine):Cursor

Gets a cursor given x and y cordinates of the component, expressed in the stage corrdinate system. If rail is non-null, it is a TextLine that acts as a rail. If the point is in the rail or in the top half of the following line, then it is "moved" in the rail before being interpreted.

Parameters

stageX:Number
stageY:Number
rail:TextLine

Returns

Cursor

event2word()


protected final function event2word(stageX:Number, stageY:Number, consumer:Function):void

Based on x and y positions in the stage corrdinate system, call the consumer with the logical start and end of the word in the text. The consumer should look like the following. function ( wordStart:int, wordEnd:int ):void

Parameters

stageX:Number
stageY:Number
consumer:Function

getTextAlignment()


protected function getTextAlignment():String

Gets the text alignment for laying out the text. When the format.align property is set to "start", "left" is returned when the text is rendered left to right, and "right" when the text is rendered right to left. When the format.align property is set to "end", "left" is returned when the text is rendered right to left, and "right" when the text is rendered left to right.

Returns

String

getTextLineAt()


public function getTextLineAt(index:int):TextLine

Gets a TextLine instance at a specific index.

Parameters

index:int — The index of the TextLine to return.

Returns

TextLine

getTextToDisplay()


protected function getTextToDisplay():String

Gets the text to be rendered by the component. Component developers can override this method in order to modify the text before rendering it.

Returns

String

mouseFocusChange()


public function mouseFocusChange(event:FocusEvent):void

Checks to see if focus is about to be lost when interacting with an object in the control.

Parameters

event:FocusEvent

position2cursor()


protected final function position2cursor(position:int):Cursor

Return a Cursor object given the specified position in the text.

Parameters

position:int — The position in the text to place the cursor.

Returns

Cursor

positionLines()


protected function positionLines(width:Number, height:Number, lines:Vector.<TextLine>):Point

Positions all of the created text lines given a specified width and height.

This method is responsible for setting the actualTextWidth and actualTextHeight properties, which are returned in the public textWidth and textHeight properties of the component. These values are used to measure the width and height of the text once it is all laid out.

Parameters

width:Number — The width to position the text lines within.
height:Number — The height to position the text lines within.
lines:Vector.<TextLine> — A Vector of TextLines that represent all of the created lines that are to be laid out.

Returns

Point — A Point where the x value is the width of the text and the y value is the height of the text.

registerEmoticons()


public function registerEmoticons(emoticons:Vector.<Emoticon>):void

Registers a set of emoticons with the text component.

If there are already emoticons set, then they are replaced with the specified set. If the emoticons parameter is set to null, it will remove all previously registered emoticons.

By default no emoticons are registered with the component.

Parameters

emoticons:Vector.<Emoticon>

See also

Emoticon

removeLines()


protected function removeLines():void

Removes the current TextLine instances from the display list.

scrollInView()


public function scrollInView(position:int, immediate:Boolean = false):void

Scrolls the position into view.

Parameters

position:int — The index in the text to scroll into view.
immediate:Boolean (default = false) — When set to true the position is immediately scrolled into view. By default this argument is set to false and will scroll the text into view when the component has been validated.

scrollUpdate()


protected function scrollUpdate():void

Called when the text is moving during a scroll.

setSelection()


public function setSelection(anchorIndex:int, activeIndex:int):void

Sets the range of selected text.

You must set the selectable and enabled to true in order to create a selection.

Parameters

anchorIndex:int — The first character position of the selection.
activeIndex:int — The last character position of the seletion.


Throws

ArgumentError — When the anchorIndex value is bigger then the activeIndex.

See also

selectable

Event Detail

layoutEstimateChange


Event Object Type: qnx.fuse.ui.events.TextEvent
TextEvent.type property = qnx.fuse.ui.events.TextEvent.LAYOUT_ESTIMATE_CHANGE

This event is fired when the dimensions of the text have changed.

selectionChanged


Event Object Type: qnx.fuse.ui.events.TextEvent
TextEvent.type property = qnx.fuse.ui.events.TextEvent.SELECTION_CHANGED

This event is fired when a selection change on the component occurs. This will also fire when a selection is cleared.