LensStudio:Ui.KeyEvent
ClassInput event describing a keyboard key press, including key code, modifiers, and text.
Index
Example
const UiTest = await import('LensStudio:UiTest');
const { Key, KeyboardModifier } = await import('LensStudio:Ui');
const ctrlA = UiTest.KeyEvent(
UiTest.EventType.KeyPress,
Key.Key_A,
KeyboardModifier.ControlModifier,
'a',
);
console.log(`KeyEvent: key=${ctrlA.key} modifiers=${ctrlA.modifiers} text="${ctrlA.text}"`);
Extends
Properties
key
readonlykey:Key
Key code identifying which key triggered the event.
modifiers
readonlymodifiers:KeyboardModifier
Bitmask of keyboard modifiers (Shift, Ctrl, Alt, Meta) active when the key was pressed.
text
readonlytext:string
Unicode text produced by the key press, if any.
Methods
accept()
accept():
void
Marks the event as handled so it will not propagate further.
Returns
void
Inherited from
getTypeName()
staticgetTypeName():string
Returns the type name of this class.
Returns
string
Overrides
getTypeName()
getTypeName():
string
Returns the name of this object's type.
Returns
string
Inherited from
ignore()
ignore():
void
Marks the event as unhandled so it propagates to parent widgets.
Returns
void
Inherited from
isOfType()
isOfType(
type):boolean
Returns true if the object is of the specified type.
Parameters
| Parameter | Type |
|---|---|
type | string |
Returns
boolean
Inherited from
isSame()
isSame(
other):boolean
Returns true if this object refers to the same instance as the given object.
Parameters
| Parameter | Type |
|---|---|
other | ScriptObject |
Returns
boolean