TextInputSystem
ClassProvides access to the device's input system.
- Available on all platforms
Provides access to the device's input system. Accessible through global.textInputSystem.
Index
Methods
Example
var options = new TextInputSystem.KeyboardOptions();
options.enablePreview = false;
options.keyboardType = TextInputSystem.KeyboardType.Text;
options.returnKeyType = TextInputSystem.ReturnKeyType.Done;
global.textInputSystem.requestKeyboard(options);
Extends
Methods
dismissKeyboard()
dismissKeyboard():
void
Requests the client to hide the keyboard and clear any existing text in the inivisible text view.
Returns
void
Since
Lens Scripting Version 165
Example
var options = new TextInputSystem.KeyboardOptions();
global.textInputSystem.requestKeyboard(options);
global.textInputSystem.dismissKeyboard();
getTypeName()
staticgetTypeName():TypeName<TextInputSystem>
Returns the fully-qualified JavaScript type name for this class (for example, "Component.Camera"). This is a static accessor (no instance required) and returns the same value as the instance getTypeName().
Returns
TypeName<TextInputSystem>
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object matches or derives from the passed in type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object is the same as other. Useful for checking if two references point to the same thing.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean
Inherited from
requestKeyboard()
requestKeyboard(
options):void
Requests the client to pop up the keyboard with specific type and return key type, fill the inivisible text view with the initial text, and set the selected text range. When user starts editing the text, the new text string and the new selected range are returned to the lens by invoking the onTextChanged function.
Parameters
| Parameter | Type |
|---|---|
options | KeyboardOptions |
Returns
void
Since
Lens Scripting Version 165
setEditingPosition()
setEditingPosition(
position):void
Requests the client to set the editing ("cursor") position on the invisible text view.
Parameters
| Parameter | Type |
|---|---|
position | number |
Returns
void
Since
Lens Scripting Version 165
Example
var options = new TextInputSystem.KeyboardOptions();
global.textInputSystem.requestKeyboard(options);
global.textInputSystem.setEditingPosition(10);
setSelectedTextRange()
setSelectedTextRange(
range):void
Requests the client to set the selected text range on the invisible text view.
Parameters
| Parameter | Type |
|---|---|
range | vec2 |
Returns
void
Since
Lens Scripting Version 165
Example
var options = new TextInputSystem.KeyboardOptions();
global.textInputSystem.requestKeyboard(options);
global.textInputSystem.setSelectedTextRange(new glm.vec2(0, 10));
updateText()
updateText(
update):void
SPECS
Requests the client to update the text and selection on the invisible text view. Only has effect when the keyboard is shown (after requestKeyboard). Supported on platforms that implement the text input session (e.g. SnapOS).
Parameters
| Parameter | Type |
|---|---|
update | TextUpdate |
Returns
void
Since
Lens Scripting Version 365
Example
var options = new TextInputSystem.KeyboardOptions();
global.textInputSystem.requestKeyboard(options);
var update = new TextInputSystem.TextUpdate();
update.text = "Hello, world!";
update.selectionStart = 0;
update.selectionEnd = 10;
global.textInputSystem.updateText(update);
Nested types
Enumerations
| Enumeration | Description |
|---|---|
| KeyboardKind | The kind of keyboard currently serving the text input session. Delivered through onKeyboardKindChanged. |
| KeyboardType | The different input style of keyboard input. |
| ReturnKeyType | The return key style of keyboard input. |
| TextFieldAction | Editor action for the text field (e.g. when user presses action key on keyboard). |
Classes
| Class | Description |
|---|---|
| KeyboardOptions | The settings used for how the input keyboard should work. |
| TextUpdate | Text update from the input method (text and selection range). |