harmony 鸿蒙@ohos.multimodalInput.keyEvent (Key Event)

2022-08-09 浏览 (845)

@ohos.multimodalInput.keyEvent (Key Event)

The keyEvent module provides key events reported by a device. It is inherited from InputEvent.

NOTE

The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.

Modules to Import

import {Action, Key, KeyEvent} from '@ohos.multimodalInput.keyEvent';

Action

Key event type.

System capability: SystemCapability.MultimodalInput.Input.Core

NameValueDescription
CANCEL0Cancellation of a key action.
DOWN1Pressing of a key.
UP2Release of a key.

Key

Defines a key.

System capability: SystemCapability.MultimodalInput.Input.Core

NameTypeReadableWritableDescription
codeKeyCodeYesNoKeycode.
pressedTimenumberYesNoDuration for pressing a key, in μs.
deviceIdnumberYesNoID of the device to which the key belongs.

KeyEvent

Key event.

System capability: SystemCapability.MultimodalInput.Input.Core

NameTypeReadableWritableDescription
actionActionYesNoKey action.
keyKeyYesNoKey for which the event is reported.
unicodeCharnumberYesNoUnicode character corresponding to the key.
keysKey []YesNoList of pressed keys.
ctrlKeybooleanYesNoWhether ctrlKey is being pressed.
The value true indicates that the key is pressed, and the value false indicates the opposite.
altKeybooleanYesNoWhether altKey is being pressed.
shiftKeybooleanYesNoWhether shiftKey is being pressed.
logoKeybooleanYesNoWhether logoKey is being pressed.
fnKeybooleanYesNoWhether fnKey is being pressed.
capsLockbooleanYesNoWhether capsLock is active.
The value true indicates that capsLock is active, and the value false indicates the opposite.
numLockbooleanYesNoWhether numLock is active.
scrollLockbooleanYesNoWhether scrollLock is active.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙APIs

harmony 鸿蒙System Common Events (To Be Deprecated Soon)

harmony 鸿蒙System Common Events

harmony 鸿蒙API Reference Document Description

harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)

harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)

harmony 鸿蒙@ohos.bundle (Bundle)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/8930024ddc2d44b7a7bf201fa572e79d