Object: TextEvent
The TextEvent object extends the UIEvent object and represents an event generated by entering characters using either the BlackBerry device or some other input source, such as a voice command. Unlike with KeyboardEvent objects, TextEvent objects can comprise multiple key presses, essentially creating an event after one or more characters have been entered.
To create an instance of a TextEvent, you must invoke Document.createEvent() with an input parameter of ”TextEvent”.
TextEvent properties
Property name |
Type |
Description |
Status |
Availability |
|---|---|---|---|---|
data |
String |
Returns the value of the characters generated by the character device. The value of this property may be a single Unicode character or a sequence of Unicode characters. This property cannot be null or contain an empty string. |
read only |
4.6 or later |
Text event types
TextEvent methods
Method: TextEvent.initTextEvent()
The initTextEvent() method initializes the value of a TextEvent created by Document.createEvent().
Parameters
Parameter |
Type |
Description |
|---|---|---|
typeArg |
String |
Specifies the event type. |
canBubbleArg |
boolean |
When true, this parameter indicates that the event can bubble. |
cancelableArg |
boolean |
When true, this parameter indicates that the event can be cancelled. |
viewArg |
AbstractView |
Specifies the window or frame that is generating the event. |
dataArg |
String |
Specifies the characters generated by the input device. This parameter sets the value of TextEvent.data. |
Method: TextEvent.initTextEventNS()
The initTextEventNS() method initializes the value of a TextEvent created by Document.createEvent() with the given namespace URI.
Syntax
TextEvent.initTextEventNS( namespaceURI, typeArg, canBubbleArg, cancelableArg, viewArg, dataArg )
Parameters
Parameter |
Type |
Description |
|---|---|---|
namespaceURI |
String |
Specifies the namespace URI associated with this event, or null if no namespace exists. |
typeArg |
String |
Specifies the event type. |
canBubbleArg |
boolean |
When true, this parameter indicates that the event can bubble. |
cancelableArg |
boolean |
When true, this parameter indicates that the event can be cancelled. |
viewArg |
AbstractView |
Specifies the window or frame that is generating the event. |
dataArg |
String |
Specifies the characters generated by the input device. This parameter sets the value of TextEvent.data. |