qnx.fuse.ui.text.EditableText

EditableText

Properties | Methods | Events


Packageqnx.fuse.ui.text
Classpublic class EditableText
InheritanceEditableText Inheritance TextBase Inheritance UIComponent Inheritance flash.display.MovieClip
Implements flash.text.ime.IIMEClient

The EditableText class provides functionality to input text.

The following listing creates an EditableText instance:

var myEditableText:EditableText = new EditableText();
myEditableText.x = 150;
myEditableText.y = 200;
myEditableText.setActualSize(300, 200);
myEditableText.text = "Lorem ipsum dolor sit amet, consectetur " +
        "adipiscing elit. In blandit, erat euismod sagittis semper," +
        " libero mi semper orci, vel suscipit purus lectus nec velit.";
myEditableText.autoCapitalize = AutoCapitalize.SENTENCE;
this.addChild(myEditableText);
     


Class information:
BlackBerry 10 Version:   10.0.0

See also

TextArea
TextInput



Public Properties

 PropertyDefined By
  autoCapitalize : String
Gets or sets a value that enables auto-capitalization when the user inputs text.
EditableText
  autoCorrect : Boolean
Gets or sets a value that enables auto-correct when text is entered by the user.
EditableText
 InheritedcontextActions : Vector.<ActionSet>
Gets or Sets a Vector of ActionSet objects.
UIComponent
 InheritedcontextMultiSelectText : String
Gets or Sets a String to be displayed when showing the Multi Select Context Menu.
UIComponent
 InheritedcurrentTheme : String
[read-only] Returns the current theme this component is styled with.
UIComponent
  cursorColor : uint
Gets or sets the color of the cursor when editing.
EditableText
  disableReturnKey : Boolean
Gets or sets a value that disables the return key on the soft keyboard.
EditableText
  displayAsPassword : Boolean
Gets or sets a value that determines whether the control is a password field.
EditableText
  editable : Boolean
Gets or sets a value that determines if text can be modified.
EditableText
  editing : Boolean
[read-only] Returns true when the user starts editing the text and false when the user stops editing.
EditableText
 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
  forceLatinKeyboard : Boolean
When set to true, forces the keyboard to show the latin key layout.
EditableText
 Inheritedformat : TextFormat
Gets or sets the format of the text.
TextBase
 Inheritedid : String
The id is a name for the component that can be used in CSS using the # selector.
UIComponent
 InheritedincludeInLayout : Boolean
Specifies whether or not the component should be included in its parent container's layout.
UIComponent
 InheritedlayoutComplete : Boolean
[read-only] Returns true if all of the text has been renderered and laid out.
TextBase
 InheritedlayoutData : Object
Gets or sets the layoutData.
UIComponent
 Inheritedlength : int
[read-only] Returns the length of the text that is being rendered.
TextBase
 Inheritedlocale : String
Gets or sets the current locale of the component.
UIComponent
  maskPassword : Boolean
Gets or sets a value that determines whether to mask the text of a password field.
EditableText
  maxChars : int
Gets or sets the maximum number of characters that can be entered in the field.
EditableText
 InheritedmaxLines : 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
 InheritedminLines : 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
  restrict : String
Gets or sets the set of characters (as a String) that a user can enter into the text field.
EditableText
  returnKeyLabel : String
Gets or sets the label of the return key on the soft keyboard.
EditableText
 Inheritedselectable : Boolean
Gets or sets a value that determines whether text can be selected.
TextBase
 Inheritedselected : Boolean
[read-only] Returns true if the component has a text selection and false if it does not.
TextBase
 InheritedselectionActiveIndex : int
[read-only] Returns the zero-based index of the first character in the selection.
TextBase
 InheritedselectionAnchorIndex : int
[read-only] Returns the zero-based index of the last character in the selection.
TextBase
  softKeyboardType : String
Gets or sets the type of keyboard to be displayed when an editing session begins.
EditableText
  spellCheck : Boolean
Gets or sets a value that enables spell-check.
EditableText
 InheritedstyleChildren : Boolean
Allows you to style the children of this component with CSS.
UIComponent
 Inheritedtext : String
Gets or sets the text of the component.
TextBase
 InheritedtextHeight : Number
[read-only] Gets the current height of the text.
TextBase
 InheritedtextWidth : Number
[read-only] Gets the current width of the text.
TextBase
 InheritedvirtualLayout : Boolean
Gets or sets the virtualLayout property.
TextBase

Protected Properties

 PropertyDefined By
 InheritedaccessibilityImplimentationClass : Class
UIComponent
 InheritedcssID : String
[override] [read-only] Returns the CSS ID of the component.
TextBase
 InheritedenableEmoticons : Boolean
Gets or sets a value that enables or disables emoticons from being displayed.
TextBase
 InheritedexplicitLocale : Boolean
Set to true when the locale property has been set externally.
UIComponent
 InheritedinternalID : String
The Component's Id used for styling.
UIComponent
 InheritedlongPressEnabled : Boolean
Specifies whether the UIComponent can detect a long press.
UIComponent
 InheriteduserSelection : Boolean
Returns true if the user initiated the selection.
TextBase

Public Methods

 MethodDefined By
  
Creates an EditableText instance.
EditableText
 Inherited
Cancels a long press from occuring on the component.
UIComponent
 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
  
deleteText(startIndex:int = 0, endIndex:int = -1):void
Deletes the text between a given start and end index.
EditableText
 Inherited
destroy():void
Call this method when you want to have your object collected by the garbage collector.
UIComponent
 Inherited
Returns the CSS selector for the object, composing it from its position in the display hierarchy and an optional ID selector.
UIComponent
 Inherited
Returns the size options for the given control.
UIComponent
 Inherited
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
  
Calculates and sets the softKeyboardInputAreaOfInterest property.
EditableText
 Inherited
registerEmoticons(emoticons:Vector.<Emoticon>):void
Registers a set of emoticons with the text component.
TextBase
  
replaceText(startIndex:int, endIndex:int, insert:String):void
Replaces the text between at a given start and end index.
EditableText
 Inherited
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
 Inherited
setSelection(anchorIndex:int, activeIndex:int):void
Sets the range of selected text.
TextBase
 Inherited
updateDefaultLocale(updateChildren:Boolean = true):void
Updates the locale property to be the same as the locale of the device.
UIComponent
 Inherited
Lets a component that contains text know that it should update its font formats as the font settings have changed.
UIComponent
 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
addTextLine(line:TextLine):Boolean
Adds a created text line to the display list and the textLines property.
TextBase
 Inherited
allowShowContextMenu(target:IEventDispatcher):Boolean
When the user presses on the component this method is called with the object that dispatched the event.
UIComponent
 Inherited
Process properties of the component.
UIComponent
 Inherited
Process the state of the component.
UIComponent
 Inherited
Style the component after the style has changed.
UIComponent
 Inherited
composeLines(width:Number, height:Number):Boolean
Creates all TextLine instances given the specified width and height.
TextBase
 Inherited
createTextLines(width:Number, height:Number):void
Renders the text at the specified width and height.
TextBase
 Inherited
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
cursor2word(cursor:Cursor, consumer:Function):void
Based on a cursor, call the consumer with the logical start and end of the word in the text.
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
 Inherited
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
 Inherited
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
excemptFromCSSStyling(target:*, property:String = null):void
Exempts a property on an object from being styled by CSS.
UIComponent
 Inherited
flushCache():void
Invoked as part of parentLayoutChanged.
UIComponent
 Inherited
getStyleApplier():Function
A style applier is a method that gets called every time a property from the stylesheet should be applied to the component.
UIComponent
 Inherited
Gets the text alignment for laying out the text.
TextBase
 Inherited
Gets the text to be rendered by the component.
TextBase
  
insertText(insert:String, startIndex:int, endIndex:int):void
Replaces the specified text between a given start and end index.
EditableText
 Inherited
onAdded():void
Called when the instance is added to the stage.
UIComponent
 Inherited
Is called when a user is no longer long pressing on the component.
UIComponent
 Inherited
Is called when a user long presses on the component.
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
position2cursor(position:int):Cursor
Return a Cursor object given the specified position in the text.
TextBase
 Inherited
positionLine(line:TextLine, atIndex:int = -1):void
Positions an single line.
TextBase
 Inherited
positionLines(width:Number, height:Number, lines:Vector.<TextLine>):Point
Positions the specified lines.
TextBase
 Inherited
recycleLine(line:TextLine):void
Recycles the specified line and adds it to the cache to be re-used.
TextBase
 Inherited
Calling this function will refresh the ContextMenu with whatever actions were set by contextActions.
UIComponent
 Inherited
Removes the current TextLine instances from the display list.
TextBase
 Inherited
Called when the text is moving during a scroll.
TextBase
 Inherited
Shows the context menu if there are contextActions associated with the control.
UIComponent
 Inherited
styleState():void
Style the component after state has changed.
UIComponent
 Inherited
Called when text lines have been created and positioned.
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
 InheritedDispatched when an action in the Context Menu is selected.UIComponent
  Dispatched when the user changes the content of the textfield by adding or removing text.EditableText
 InheritedDispatched when the Context Menu has closed to the DISMISSED state.UIComponent
 InheritedDispatched when the ContextMenu is closing to the DISMISSED state.UIComponent
 InheritedDispatched when the Context Menu has opened to the PEEK or EXPANDED state.UIComponent
 InheritedDispatched when the ContextMenu is opening from the DISMISSED state.UIComponent
  Dispatched when the user begins to edit the text.EditableText
  Dispatched when the user has finished editing the text.EditableText
 InheritedDispatched when the textWidth or textHeight properties change.TextBase
 InheritedDispatched when the CrossCut multiselect has been canceled.UIComponent
 InheritedDispatched when there has been a change in the selection of the text.TextBase
 InheritedDispatched when a user has clicked on a link in the text.TextBase

Property Detail

autoCapitalize


autoCapitalize:String

Gets or sets a value that enables auto-capitalization when the user inputs text. Possible values are:

  • AutoCapitalize.NONE - no capitalization.
  • AutoCapitalize.SENTENCE - Sentence case capitalization (first word only).


Implementation

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

See also

AutoCapitalize

autoCorrect


autoCorrect:Boolean

Gets or sets a value that enables auto-correct when text is entered by the user.

The default value is true.


Implementation

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

cursorColor


cursorColor:uint

Gets or sets the color of the cursor when editing.

The default value is 0x00A8DF.


Implementation

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

disableReturnKey


disableReturnKey:Boolean

Gets or sets a value that disables the return key on the soft keyboard.


Implementation

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

displayAsPassword


displayAsPassword:Boolean

Gets or sets a value that determines whether the control is a password field.

To keep the field a password field and un-mask the text, set the maskPassword property to false.

The default value is false.


Implementation

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

editable


editable:Boolean

Gets or sets a value that determines if text can be modified. Set to true to make the text editable. Setting this value to false disables editing, however the text can still be selected.

The default value is true.


Implementation

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

editing


editing:Boolean  [read-only]

Returns true when the user starts editing the text and false when the user stops editing.


Implementation

public function get editing():Boolean

See also

editStart
editStop

forceLatinKeyboard


forceLatinKeyboard:Boolean

When set to true, forces the keyboard to show the latin key layout.

Users may only have non-latin keyboards set on their device. In some cases, such as passwords, users must use a latin keyboard. Setting this property to true will force the latin keyboard to appear, regardless of user preference.

The default value is false.


Implementation

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

maskPassword


maskPassword:Boolean

Gets or sets a value that determines whether to mask the text of a password field.

This property has no effect unless displayAsPassword is set to true.

The default value is true;.


Implementation

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

maxChars


maxChars:int

Gets or sets the maximum number of characters that can be entered in the field.

A script can insert more text than maxChars allows; the maxChars property indicates only how much text a user can enter. If the value of this property is 0, a user can enter an unlimited amount of text.

The default value is The default value is 0..


Implementation

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

restrict


restrict:String

Gets or sets the set of characters (as a String) that a user can enter into the text field.


Implementation

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

returnKeyLabel


returnKeyLabel:String

Gets or sets the label of the return key on the soft keyboard.


Implementation

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

See also

ReturnKeyType

softKeyboardType


softKeyboardType:String

Gets or sets the type of keyboard to be displayed when an editing session begins.


Implementation

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

See also

KeyboardType

spellCheck


spellCheck:Boolean

Gets or sets a value that enables spell-check. When spellcheck is enabled, red edit marks will be displayed below misspelled words when the user inserts text.

If the user has disabled spell check in Settings, this will always return false and setting spellCheck will do nothing.


Implementation

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

Constructor Detail

EditableText()


public function EditableText()

Creates an EditableText instance.

Method Detail

deleteText()


public function deleteText(startIndex:int = 0, endIndex:int = -1):void

Deletes the text between a given start and end index.

Parameters

startIndex:int (default = 0) — The start index of the text to delete. Default is 0.
endIndex:int (default = -1) — The end index of the text to delete. Default is -1.

insertText()


protected final function insertText(insert:String, startIndex:int, endIndex:int):void

Replaces the specified text between a given start and end index.

The current text between the start and end index is replaced by the new text. Passing an empty string as the insert parameter will delete the text between the start and end indices.

Parameters

insert:String — The text to be inserted.
startIndex:int — The start index to place the text.
endIndex:int — The end index where to place the text.

recalculateAreaOfInterest()


public function recalculateAreaOfInterest():void

Calculates and sets the softKeyboardInputAreaOfInterest property.

The softKeyboardInputAreaOfInterest is calculated based on the controls position in stage cordinates. It also takes into account the position of the cursor or selected text bounds.

You will want to call this method after a re-layout of the applications UI when the field has focus. This most commonly occurs when the application is rotated when the field has focus.

replaceText()


public function replaceText(startIndex:int, endIndex:int, insert:String):void

Replaces the text between at a given start and end index.

Parameters

startIndex:int — The start index of the text to replace.
endIndex:int — The end index of the text to replace.
insert:String — The text to insert.

Event Detail

change


Event Object Type: flash.events.Event
Event.type property = flash.events.Event.CHANGE

Dispatched when the user changes the content of the textfield by adding or removing text.

editStart


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

Dispatched when the user begins to edit the text.

This event is fired when an editing session starts on the text component.

The TextEvent.EDIT_START constant defines the value of the type property of the event object for an editStart event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe object that is actively processing the Event object with an event listener.
typeTextEvent.EDIT_START

editStop


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

Dispatched when the user has finished editing the text.

This event is fired when an editing session stops on the text component.

The TextEvent.EDIT_STOP constant defines the value of the type property of the event object for an editStop event.

The properties of the event object have the following values:

PropertyValue
bubblesfalse
cancelablefalse
currentTargetThe object that is actively processing the Event object with an event listener.
typeTextEvent.EDIT_STOP




comments powered by Disqus