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

Provides base functionality for rendering and selecting text.



Public Properties
 PropertyDefined By
 InheritedexplicitHeight : Number
[read-only]
UIComponent
 InheritedexplicitWidth : Number
[read-only]
UIComponent
  format : TextFormat
Gets or sets the format of the text.
TextBase
 InheritedincludeInLayout : Boolean
Specifies if the component should be included in it's parent containers 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 measured by a layout.
TextBase
 InheritedminHeight : Number
Sets the minimum preferred height of the control.
UIComponent
  minLines : int
Gets or sets the minimum number of lines to measured by a layout.
TextBase
 InheritedminWidth : Number
Sets the minimum preferred width of the control.
UIComponent
  selectable : Boolean
Gets or sets 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
  selectionImageBitmap : BitmapData
[static]
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
 InheriteddisplayListIsInvalid : Boolean = false
UIComponent
  enableEmoticons : Boolean
Enables or disables emoticons from being displayed.
TextBase
 InheritedpropertiesAreInvalid : Boolean = false
UIComponent
 InheritedsizeChange : Boolean
UIComponent
 InheritedstateChanged : Boolean
UIComponent
Public Methods
 MethodDefined By
  
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
UIComponent
  
getTextLineAt(index:int):TextLine
Gets a TextLine 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
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 selection of the text within a given range.
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 of the text lines 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
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
  
getTextLine(block:TextBlock = null, previousLine:TextLine = null, width:Number = 1000000, lineOffset:Number = 0.0, fitSomething:Boolean = false):TextLine
This method creates the text line.
TextBase
  
Gets the text to be rendered by the component.
TextBase
  
lineFragment2rectangle(line:TextLine, left:Number, right:Number, consumer:Function):void
Given a line fragement, call the consumer with the corresponding rectangle.
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
  
range2lineFragments(start:int, limit:int, consumer:Function):void
Given a range in the text, call the consumer with the corresponding line fragments.
TextBase
  
range2rectangles(start:int, limit:int, consumer:Function):void
Given a range in the text, call the consumer with the corresponding values for the rectangle.
TextBase
  
Removes the current TextLines 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
  Dispatched when text is laid out and the text dimensions have changed.TextBase
  Dispatched when a text selection has changed.TextBase
Property Detail
enableEmoticonsproperty
enableEmoticons:Boolean

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 result in this property being set to true. Otherwise it is set to false.


Implementation
    protected function get enableEmoticons():Boolean
    protected function set enableEmoticons(value:Boolean):void
formatproperty 
format:TextFormat

Gets or sets the format of the text.


Implementation
    public function get format():TextFormat
    public function set format(value:TextFormat):void
lengthproperty 
length:int  [read-only]

Returns the length of the text that is being rendered. This may be different then calling text.length; Emoticons in the text count as 1 character.


Implementation
    public function get length():int
localeproperty 
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
maxLinesproperty 
maxLines:int

Gets or sets the maximum number of lines to 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
minLinesproperty 
minLines:int

Gets or sets the minimum number of lines to measured by a layout. If the full text results in less lines then the minimum number of lines, 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
selectableproperty 
selectable:Boolean

Gets or sets whether text can be selected.

The default value is true.


Implementation
    public function get selectable():Boolean
    public function set selectable(value:Boolean):void
selectedproperty 
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
selectionActiveIndexproperty 
selectionActiveIndex:int  [read-only]

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


Implementation
    public function get selectionActiveIndex():int
selectionAnchorIndexproperty 
selectionAnchorIndex:int  [read-only]

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


Implementation
    public function get selectionAnchorIndex():int
selectionImageBitmapproperty 
public static var selectionImageBitmap:BitmapData

textproperty 
text:String

Gets or sets the text of the component.


Implementation
    public function get text():String
    public function set text(value:String):void
textHeightproperty 
textHeight:Number  [read-only]

Gets the current height of the text.


Implementation
    public function get textHeight():Number
textWidthproperty 
textWidth:Number  [read-only]

Gets the current width of the text.


Implementation
    public function get textWidth():Number
urlBarModeproperty 
urlBarMode:Boolean


Implementation
    qnx_internal function get urlBarMode():Boolean
    qnx_internal function set urlBarMode(value:Boolean):void
Constructor Detail
TextBase()Constructor
public function TextBase()



Method Detail
composeLines()method
protected function composeLines(width:Number, height:Number):Boolean

Creates all of the text lines given the specified width and height. This method is responsible for adding the text lines to the display list of the textHolder property. This method is responsible for adding the text lines 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 where created.
createTextLines()method 
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()method 
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()method 
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()method 
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()method 
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
getTextLine()method 
protected final function getTextLine(block:TextBlock = null, previousLine:TextLine = null, width:Number = 1000000, lineOffset:Number = 0.0, fitSomething:Boolean = false):TextLine

This method creates the text line. This method calls TextBlock.createTextLine.

Parameters

block:TextBlock (default = null)
 
previousLine:TextLine (default = null)
 
width:Number (default = 1000000)
 
lineOffset:Number (default = 0.0)
 
fitSomething:Boolean (default = false)

Returns
TextLine
getTextLineAt()method 
public function getTextLineAt(index:int):TextLine

Gets a TextLine at a specific index.

Parameters

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

Returns
TextLine
getTextToDisplay()method 
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
lineFragment2rectangle()method 
protected final function lineFragment2rectangle(line:TextLine, left:Number, right:Number, consumer:Function):void

Given a line fragement, call the consumer with the corresponding rectangle. The coordinates of the rectangle are in the same coordinate space as the TextLine. The consumer should look like the following. function( xLeft:Number, xRight:Number, yBottom:Number, yTop:Number ):void

Parameters

line:TextLine
 
left:Number
 
right:Number
 
consumer:Function

mouseFocusChange()method 
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()method 
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()method 
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.
range2lineFragments()method 
protected final function range2lineFragments(start:int, limit:int, consumer:Function):void

Given a range in the text, call the consumer with the corresponding line fragments. The consumer should look like the following. function( line:TextLine, left:Number, right:Number ):void

Parameters

start:int
 
limit:int
 
consumer:Function

range2rectangles()method 
protected final function range2rectangles(start:int, limit:int, consumer:Function):void

Given a range in the text, call the consumer with the corresponding values for the rectangle. The consumer should look like the following. function( xLeft:Number, xRight:Number, yBottom:Number, yTop:Number ):void

Parameters

start:int
 
limit:int
 
consumer:Function

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

Registers a set of emoticons with the text component. If there are already emoticons set 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

removeLines()method 
protected function removeLines():void

Removes the current TextLines from the display list.

scrollInView()method 
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()method 
protected function scrollUpdate():void

Called when the text is moving during a scroll.

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

Sets the selection of the text within a given range. The selectable and enabled property must both be set to true in order to create a selection.

Parameters

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


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

See also

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

Dispatched when text is laid out and the text dimensions have changed.

This event is fired when the dimensions of the text have changed.
selectionChanged Event  
Event Object Type: qnx.fuse.ui.events.TextEvent
TextEvent.type property = qnx.fuse.ui.events.TextEvent.SELECTION_CHANGED

Dispatched when a text selection has changed.

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