1e41f4b71Sopenharmony_ci# Component ID 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci**id** identifies a component uniquely within an application. This module provides APIs for obtaining the attributes of or sending events to the component with the specified ID. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## Attributes 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci### id 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ciid(value: string): T 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ciSets a unique identifier for this component, with uniqueness guaranteed by the user. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci**Widget capability**: This API can be used in ArkTS widgets since API version 9. 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci**Parameters** 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 26e41f4b71Sopenharmony_ci| ------ | -------- | -----|---------------------- | 27e41f4b71Sopenharmony_ci| value | string | Yes | Unique identifier for the component, with uniqueness guaranteed by the user.<br>Default value: **''**<br>| 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci### key<sup>12+</sup> 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_cikey(value: string): T 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ciSets a unique identifier for this component, with uniqueness guaranteed by the user. 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ciThis API is used only for test purposes. When this attribute is used in conjunction with **id**, the value assigned later will override the one assigned earlier. You are advised to set only **id**. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full 38e41f4b71Sopenharmony_ci 39e41f4b71Sopenharmony_ci**Parameters** 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 42e41f4b71Sopenharmony_ci| ------ | -------- | -----|---------------------- | 43e41f4b71Sopenharmony_ci| value | string | Yes| Unique identifier for the component, with uniqueness guaranteed by the user.<br>Default value: **''**<br>| 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci## APIs 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci### getInspectorByKey<sup>9+</sup> 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_cigetInspectorByKey(id: string): string 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ciObtains all attributes of the component with the specified ID, excluding the information about child components. 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ciThis API is used only for test purposes. It is time consuming and not recommended. 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ci**Parameters** 60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 62e41f4b71Sopenharmony_ci| ---- | -------- | ---- | -------------| 63e41f4b71Sopenharmony_ci| id | string | Yes | ID of the component whose attributes are to be obtained.| 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci**Return value** 66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_ci| Type | Description | 68e41f4b71Sopenharmony_ci| -------| -------------- | 69e41f4b71Sopenharmony_ci| string | JSON string of the component attribute list.<br>**NOTE**<br> The string includes the tag, ID, location (relative to the coordinates in the upper left corner of the window), and other information of the component used for testing.| 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_ci### getInspectorTree<sup>9+</sup> 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_cigetInspectorTree(): Object 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ciObtains the component tree and component attributes. 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ciThis API is used only for test purposes. It is time consuming and not recommended. 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ci**Return value** 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci| Type | Description | 84e41f4b71Sopenharmony_ci| ------ | --------------------------- | 85e41f4b71Sopenharmony_ci| Object | JSON object of the component tree and component attribute list.| 86e41f4b71Sopenharmony_ci 87e41f4b71Sopenharmony_ci### sendEventByKey<sup>9+</sup> 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_cisendEventByKey(id: string, action: number, params: string): boolean 90e41f4b71Sopenharmony_ci 91e41f4b71Sopenharmony_ciSends an event to the component with the specified ID. 92e41f4b71Sopenharmony_ci 93e41f4b71Sopenharmony_ciThis API is used only for test purposes. It is time consuming and not recommended. 94e41f4b71Sopenharmony_ci 95e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 96e41f4b71Sopenharmony_ci 97e41f4b71Sopenharmony_ci**Parameters** 98e41f4b71Sopenharmony_ci 99e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 100e41f4b71Sopenharmony_ci| ------ | -------| ---- | -------------------------- | 101e41f4b71Sopenharmony_ci| id | string | Yes | ID of the component to which the event is to be sent. | 102e41f4b71Sopenharmony_ci| action | number | Yes | Type of the event to be sent. The options are as follows:<br>- **10**: click event.<br>- **11**: long-click event.| 103e41f4b71Sopenharmony_ci| params | string | Yes | Event parameters. If there is no parameter, pass an empty string **""**. | 104e41f4b71Sopenharmony_ci 105e41f4b71Sopenharmony_ci**Return value** 106e41f4b71Sopenharmony_ci 107e41f4b71Sopenharmony_ci| Type | Description | 108e41f4b71Sopenharmony_ci| -------- | --------------------------| 109e41f4b71Sopenharmony_ci| boolean | Returns **true** if the component with the specified ID is found; returns **false** otherwise.| 110e41f4b71Sopenharmony_ci 111e41f4b71Sopenharmony_ci### sendTouchEvent<sup>9+</sup> 112e41f4b71Sopenharmony_ci 113e41f4b71Sopenharmony_cisendTouchEvent(event: TouchObject): boolean 114e41f4b71Sopenharmony_ci 115e41f4b71Sopenharmony_ciSends a touch event. 116e41f4b71Sopenharmony_ci 117e41f4b71Sopenharmony_ciThis API is used only for test purposes. It is time consuming and not recommended. 118e41f4b71Sopenharmony_ci 119e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 120e41f4b71Sopenharmony_ci 121e41f4b71Sopenharmony_ci**Parameters** 122e41f4b71Sopenharmony_ci 123e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 124e41f4b71Sopenharmony_ci| ----- | ----------- | ---- | ------------------------------------------------------------ | 125e41f4b71Sopenharmony_ci| event | [TouchObject](ts-universal-events-touch.md#touchobject) | Yes | Location where a touch event is triggered. For details, see [TouchEvent](ts-universal-events-touch.md#touchevent).| 126e41f4b71Sopenharmony_ci 127e41f4b71Sopenharmony_ci**Return value** 128e41f4b71Sopenharmony_ci 129e41f4b71Sopenharmony_ci| Type | Description | 130e41f4b71Sopenharmony_ci| ------- | ---------------------------| 131e41f4b71Sopenharmony_ci| boolean | Returns **true** if the event is sent successfully; returns **false** otherwise.| 132e41f4b71Sopenharmony_ci 133e41f4b71Sopenharmony_ci### sendKeyEvent<sup>9+</sup> 134e41f4b71Sopenharmony_ci 135e41f4b71Sopenharmony_cisendKeyEvent(event: KeyEvent): boolean 136e41f4b71Sopenharmony_ci 137e41f4b71Sopenharmony_ciSends a key event. 138e41f4b71Sopenharmony_ci 139e41f4b71Sopenharmony_ciThis API is used only for test purposes. It is time consuming and not recommended. 140e41f4b71Sopenharmony_ci 141e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 142e41f4b71Sopenharmony_ci 143e41f4b71Sopenharmony_ci**Parameters** 144e41f4b71Sopenharmony_ci 145e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 146e41f4b71Sopenharmony_ci| ----- | -------- | ---- | ------------------------------------------------------------ | 147e41f4b71Sopenharmony_ci| event | [KeyEvent](ts-universal-events-key.md#keyevent) | Yes | Key event. For details, see [KeyEvent](ts-universal-events-key.md#keyevent).| 148e41f4b71Sopenharmony_ci 149e41f4b71Sopenharmony_ci**Return value** 150e41f4b71Sopenharmony_ci 151e41f4b71Sopenharmony_ci| Type | Description | 152e41f4b71Sopenharmony_ci| ------- | ------------------------------| 153e41f4b71Sopenharmony_ci| boolean | Returns **true** if the event is sent successfully; returns **false** otherwise.| 154e41f4b71Sopenharmony_ci 155e41f4b71Sopenharmony_ci### sendMouseEvent<sup>9+</sup> 156e41f4b71Sopenharmony_ci 157e41f4b71Sopenharmony_cisendMouseEvent(event: MouseEvent): boolean 158e41f4b71Sopenharmony_ci 159e41f4b71Sopenharmony_ciSends a mouse event. 160e41f4b71Sopenharmony_ci 161e41f4b71Sopenharmony_ciThis API is used only for test purposes. It is time consuming and not recommended. 162e41f4b71Sopenharmony_ci 163e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 11. 164e41f4b71Sopenharmony_ci 165e41f4b71Sopenharmony_ci**Parameters** 166e41f4b71Sopenharmony_ci 167e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 168e41f4b71Sopenharmony_ci| ----- | ---------- | ---- | --------------------------------------- | 169e41f4b71Sopenharmony_ci| event | [MouseEvent](ts-universal-mouse-key.md#mouseevent) | Yes | Mouse event. For details, see [MouseEvent](ts-universal-mouse-key.md#mouseevent).| 170e41f4b71Sopenharmony_ci 171e41f4b71Sopenharmony_ci**Return value** 172e41f4b71Sopenharmony_ci 173e41f4b71Sopenharmony_ci| Type | Description | 174e41f4b71Sopenharmony_ci| ------- | ---------------------------------- | 175e41f4b71Sopenharmony_ci| boolean | Returns **true** if the event is sent successfully; returns **false** otherwise.| 176e41f4b71Sopenharmony_ci 177e41f4b71Sopenharmony_ci## Example 178e41f4b71Sopenharmony_ci 179e41f4b71Sopenharmony_ci```ts 180e41f4b71Sopenharmony_ci// xxx.ets 181e41f4b71Sopenharmony_ciimport { IntentionCode } from '@kit.InputKit' 182e41f4b71Sopenharmony_ci 183e41f4b71Sopenharmony_ciclass Utils { 184e41f4b71Sopenharmony_ci static rect_left: number 185e41f4b71Sopenharmony_ci static rect_top: number 186e41f4b71Sopenharmony_ci static rect_right: number 187e41f4b71Sopenharmony_ci static rect_bottom: number 188e41f4b71Sopenharmony_ci static rect_value: Record<string, number> 189e41f4b71Sopenharmony_ci 190e41f4b71Sopenharmony_ci // Obtain the coordinates of the rectangular area occupied by the component. 191e41f4b71Sopenharmony_ci static getComponentRect(key:string):Record<string, number> { 192e41f4b71Sopenharmony_ci let strJson = getInspectorByKey(key) 193e41f4b71Sopenharmony_ci let obj:Record<string, string> = JSON.parse(strJson) 194e41f4b71Sopenharmony_ci console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj)) 195e41f4b71Sopenharmony_ci let rectInfo:string[] = JSON.parse('[' + obj.$rect + ']') 196e41f4b71Sopenharmony_ci console.info("[getInspectorByKey] rectInfo is: " + rectInfo) 197e41f4b71Sopenharmony_ci Utils.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0] 198e41f4b71Sopenharmony_ci Utils.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1] 199e41f4b71Sopenharmony_ci Utils.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0] 200e41f4b71Sopenharmony_ci Utils.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1] 201e41f4b71Sopenharmony_ci return Utils.rect_value = { 202e41f4b71Sopenharmony_ci "left": Utils.rect_left, "top": Utils.rect_top, "right": Utils.rect_right, "bottom": Utils.rect_bottom 203e41f4b71Sopenharmony_ci } 204e41f4b71Sopenharmony_ci } 205e41f4b71Sopenharmony_ci} 206e41f4b71Sopenharmony_ci 207e41f4b71Sopenharmony_ci@Entry 208e41f4b71Sopenharmony_ci@Component 209e41f4b71Sopenharmony_cistruct IdExample { 210e41f4b71Sopenharmony_ci @State text: string = '' 211e41f4b71Sopenharmony_ci 212e41f4b71Sopenharmony_ci build() { 213e41f4b71Sopenharmony_ci Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { 214e41f4b71Sopenharmony_ci 215e41f4b71Sopenharmony_ci Button() { 216e41f4b71Sopenharmony_ci Text('onKeyTab').fontSize(25).fontWeight(FontWeight.Bold) 217e41f4b71Sopenharmony_ci }.margin({ top: 20 }).backgroundColor('#0D9FFB') 218e41f4b71Sopenharmony_ci .onKeyEvent(() => { 219e41f4b71Sopenharmony_ci this.text = "onKeyTab" 220e41f4b71Sopenharmony_ci }) 221e41f4b71Sopenharmony_ci 222e41f4b71Sopenharmony_ci Button() { 223e41f4b71Sopenharmony_ci Text('click to start').fontSize(25).fontWeight(FontWeight.Bold) 224e41f4b71Sopenharmony_ci }.margin({ top: 20 }) 225e41f4b71Sopenharmony_ci .onClick(() => { 226e41f4b71Sopenharmony_ci console.info(getInspectorByKey("click")) 227e41f4b71Sopenharmony_ci console.info(JSON.stringify(getInspectorTree())) 228e41f4b71Sopenharmony_ci this.text = "Button 'click to start' is clicked" 229e41f4b71Sopenharmony_ci setTimeout(() => { 230e41f4b71Sopenharmony_ci sendEventByKey("longClick", 11, "") // Send a long-click event to the component whose ID is "longClick". 231e41f4b71Sopenharmony_ci }, 2000) 232e41f4b71Sopenharmony_ci }).id('click') 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ci Button() { 235e41f4b71Sopenharmony_ci Text('longClick').fontSize(25).fontWeight(FontWeight.Bold) 236e41f4b71Sopenharmony_ci }.margin({ top: 20 }).backgroundColor('#0D9FFB') 237e41f4b71Sopenharmony_ci .gesture( 238e41f4b71Sopenharmony_ci LongPressGesture().onActionEnd(() => { 239e41f4b71Sopenharmony_ci console.info('long clicked') 240e41f4b71Sopenharmony_ci this.text = "Button 'longClick' is longclicked" 241e41f4b71Sopenharmony_ci setTimeout(() => { 242e41f4b71Sopenharmony_ci let rect = Utils.getComponentRect('onTouch') // Obtain the coordinates of the rectangular area occupied by the component whose ID is "onTouch". 243e41f4b71Sopenharmony_ci let touchPoint: TouchObject = { 244e41f4b71Sopenharmony_ci id: 1, 245e41f4b71Sopenharmony_ci type: TouchType.Down, 246e41f4b71Sopenharmony_ci x: rect.left + (rect.right - rect.left) / 2, // X coordinate relative to the upper left corner of the component. 247e41f4b71Sopenharmony_ci y: rect.top + (rect.bottom - rect.top) / 2, // Y coordinate relative to the upper left corner of the component. 248e41f4b71Sopenharmony_ci screenX: rect.left + (rect.right - rect.left) / 2, // X coordinate relative to the upper left corner of the application window. This API is deprecated since API version 10. Use windowX instead. 249e41f4b71Sopenharmony_ci screenY: rect.left + (rect.right - rect.left) / 2, // Y coordinate relative to the upper left corner of the application window. This API is deprecated since API version 10. Use windowY instead. 250e41f4b71Sopenharmony_ci windowX: rect.left + (rect.right - rect.left) / 2, // X coordinate relative to the upper left corner of the application window. 251e41f4b71Sopenharmony_ci windowY: rect.left + (rect.right - rect.left) / 2, // Y coordinate relative to the upper left corner of the application window. 252e41f4b71Sopenharmony_ci displayX: rect.left + (rect.right - rect.left) / 2, // X coordinate relative to the upper left corner of the device screen. 253e41f4b71Sopenharmony_ci displayY: rect.left + (rect.right - rect.left) / 2, // Y coordinate relative to the upper left corner of the device screen. 254e41f4b71Sopenharmony_ci } 255e41f4b71Sopenharmony_ci sendTouchEvent(touchPoint) // Send a touch event. 256e41f4b71Sopenharmony_ci touchPoint.type = TouchType.Up 257e41f4b71Sopenharmony_ci sendTouchEvent(touchPoint) // Send a touch event. 258e41f4b71Sopenharmony_ci }, 2000) 259e41f4b71Sopenharmony_ci })).id('longClick') 260e41f4b71Sopenharmony_ci 261e41f4b71Sopenharmony_ci Button() { 262e41f4b71Sopenharmony_ci Text('onTouch').fontSize(25).fontWeight(FontWeight.Bold) 263e41f4b71Sopenharmony_ci }.type(ButtonType.Capsule).margin({ top: 20 }) 264e41f4b71Sopenharmony_ci .onClick(() => { 265e41f4b71Sopenharmony_ci console.info('onTouch is clicked') 266e41f4b71Sopenharmony_ci this.text = "Button 'onTouch' is clicked" 267e41f4b71Sopenharmony_ci setTimeout(() => { 268e41f4b71Sopenharmony_ci let rect = Utils.getComponentRect('onMouse') // Obtain the coordinates of the rectangular area occupied by the component whose ID is "onMouse". 269e41f4b71Sopenharmony_ci let mouseEvent: MouseEvent = { 270e41f4b71Sopenharmony_ci button: MouseButton.Left, 271e41f4b71Sopenharmony_ci action: MouseAction.Press, 272e41f4b71Sopenharmony_ci x: rect.left + (rect.right - rect.left) / 2, // X coordinate relative to the upper left corner of the component. 273e41f4b71Sopenharmony_ci y: rect.top + (rect.bottom - rect.top) / 2, // Y coordinate relative to the upper left corner of the component. 274e41f4b71Sopenharmony_ci screenX: rect.left + (rect.right - rect.left) / 2, // X coordinate relative to the upper left corner of the application window. This API is deprecated since API version 10. Use windowX instead. 275e41f4b71Sopenharmony_ci screenY: rect.left + (rect.right - rect.left) / 2, // Y coordinate relative to the upper left corner of the application window. This API is deprecated since API version 10. Use windowY instead. 276e41f4b71Sopenharmony_ci windowX: rect.left + (rect.right - rect.left) / 2, // X coordinate relative to the upper left corner of the application window. 277e41f4b71Sopenharmony_ci windowY: rect.left + (rect.right - rect.left) / 2, // Y coordinate relative to the upper left corner of the application window. 278e41f4b71Sopenharmony_ci displayX: rect.left + (rect.right - rect.left) / 2, // X coordinate relative to the upper left corner of the device screen. 279e41f4b71Sopenharmony_ci displayY: rect.left + (rect.right - rect.left) / 2, // Y coordinate relative to the upper left corner of the device screen. 280e41f4b71Sopenharmony_ci stopPropagation: () => { 281e41f4b71Sopenharmony_ci }, 282e41f4b71Sopenharmony_ci timestamp: 1, 283e41f4b71Sopenharmony_ci target: { 284e41f4b71Sopenharmony_ci area: { 285e41f4b71Sopenharmony_ci width: 1, 286e41f4b71Sopenharmony_ci height: 1, 287e41f4b71Sopenharmony_ci position: { 288e41f4b71Sopenharmony_ci x: 1, 289e41f4b71Sopenharmony_ci y: 1 290e41f4b71Sopenharmony_ci }, 291e41f4b71Sopenharmony_ci globalPosition: { 292e41f4b71Sopenharmony_ci x: 1, 293e41f4b71Sopenharmony_ci y: 1 294e41f4b71Sopenharmony_ci } 295e41f4b71Sopenharmony_ci } 296e41f4b71Sopenharmony_ci }, 297e41f4b71Sopenharmony_ci source: SourceType.Mouse, 298e41f4b71Sopenharmony_ci pressure: 1, 299e41f4b71Sopenharmony_ci tiltX: 1, 300e41f4b71Sopenharmony_ci tiltY: 1, 301e41f4b71Sopenharmony_ci sourceTool: SourceTool.Unknown 302e41f4b71Sopenharmony_ci } 303e41f4b71Sopenharmony_ci sendMouseEvent(mouseEvent) // Send a mouse event. 304e41f4b71Sopenharmony_ci }, 2000) 305e41f4b71Sopenharmony_ci }).id('onTouch') 306e41f4b71Sopenharmony_ci 307e41f4b71Sopenharmony_ci Button() { 308e41f4b71Sopenharmony_ci Text('onMouse').fontSize(25).fontWeight(FontWeight.Bold) 309e41f4b71Sopenharmony_ci }.margin({ top: 20 }).backgroundColor('#0D9FFB') 310e41f4b71Sopenharmony_ci .onMouse(() => { 311e41f4b71Sopenharmony_ci console.info('onMouse') 312e41f4b71Sopenharmony_ci this.text = "Button 'onMouse' in onMouse" 313e41f4b71Sopenharmony_ci setTimeout(() => { 314e41f4b71Sopenharmony_ci let keyEvent: KeyEvent = { 315e41f4b71Sopenharmony_ci type: KeyType.Down, 316e41f4b71Sopenharmony_ci keyCode: 2049, 317e41f4b71Sopenharmony_ci keyText: 'tab', 318e41f4b71Sopenharmony_ci keySource: 4, 319e41f4b71Sopenharmony_ci deviceId: 0, 320e41f4b71Sopenharmony_ci metaKey: 0, 321e41f4b71Sopenharmony_ci timestamp: 0, 322e41f4b71Sopenharmony_ci stopPropagation: () => { 323e41f4b71Sopenharmony_ci }, 324e41f4b71Sopenharmony_ci intentionCode: IntentionCode.INTENTION_DOWN 325e41f4b71Sopenharmony_ci } 326e41f4b71Sopenharmony_ci sendKeyEvent(keyEvent) // Send a key event. 327e41f4b71Sopenharmony_ci }, 2000) 328e41f4b71Sopenharmony_ci }).id('onMouse') 329e41f4b71Sopenharmony_ci 330e41f4b71Sopenharmony_ci Text(this.text).fontSize(25).padding(15) 331e41f4b71Sopenharmony_ci } 332e41f4b71Sopenharmony_ci .width('100%').height('100%') 333e41f4b71Sopenharmony_ci } 334e41f4b71Sopenharmony_ci} 335e41f4b71Sopenharmony_ci``` 336