Keyboard

Description

The Keyboard object represents a keyboard input device attached to the local system. Keyboards can be any kind of input devices with one or multiple keys. This also includes devices simulating key presses such as HID-based barcode scanners connected via USB. This object allows receiving key press events and key release events as well as any entered text from the input device.

This object was introduced in InCore 2.3.

› Inherits:Object

Properties

enabled

This property holds whether the device is enabled, i.e. key events are processed and the corresponding signals are emitted.

› Type:Boolean
› Default:false
› Signal:enabledChanged()
› Attributes:Writable

inputDeviceFile

This property holds the input device file of the keyboard represented by this object.

› Type:String
› Signal:inputDeviceFileChanged()
› Attributes:Readonly

name

This property holds the name of the keyboard device, if available.

› Type:String
› Signal:nameChanged()
› Attributes:Readonly

physicalLocation

This property holds the physical location of the keyboard device (e.g. usb-musb-hdrc.1-1.1.2), if available.

› Type:String
› Signal:physicalLocationChanged()
› Attributes:Readonly

productIdentifier

This property holds the product identifier of the keyboard device, if available.

› Type:SignedInteger
› Signal:productIdentifierChanged()
› Attributes:Readonly

vendorIdentifier

This property holds the vendor identifier of the keyboard device, if available.

› Type:SignedInteger
› Signal:vendorIdentifierChanged()
› Attributes:Readonly

Signals

keyPressed(SignedInteger key, Keyboard.Modifiers modifiers, Boolean autoRepeat)

This signal is emitted whenever a key is pressed or auto-repeated while pressed. The key argument contains the corresponding key code. Any active modifiers (such as Shift or Ctrl) are indicated through the modifiers argument. If the key event was caused by auto-repeat, the autoRepeat argument is true. If automatically repeated key

keyReleased(SignedInteger key, Keyboard.Modifiers modifiers)

This signal is emitted whenever a key is released. The key argument contains the corresponding key code. Any active modifiers (such as Shift or Ctrl) are indicated through the modifiers argument.

textEntered(String text)

This signal is emitted whenever a text is entered, i.e. a character or numeric key is pressed.

Enumerations

Modifiers

This enumeration describes the modifier keys which can be pressed while other keys are pressed.

Name Value Description
Keyboard.NoModifier 0 No modifier key is pressed.
Keyboard.ShiftModifier 33554432 A Shift key on the keyboard is pressed.
Keyboard.ControlModifier 67108864 A Ctrl key on the keyboard is pressed.
Keyboard.AltModifier 134217728 A Alt key on the keyboard is pressed.
Keyboard.MetaModifier 268435456 A Meta key on the keyboard is pressed.
Keyboard.KeypadModifier 536870912 A keypad button is pressed.

Example

See KeyboardManager example on how to use Keyboard.