KeyEvent

class KeyEvent(val eventType: EventType<KeyEvent>, val key: Key, val scanCode: Int, val repeated: Boolean, val mods: Int) : Event

These events are fired when a key is pressed or released. Do not use these events to detect characters being typed (use KeyTypedEvent).

There is no simple relationship between KeyEvent and KeyTypedEvents, it's complicated, and platform dependent. For example, on my laptop, I can generate a KeyTypedEvent for the degree character °, by holding down CapsLock and pressing O twice. (On Linux, I've set CapsLock as my Compose key, which combines the next 2 keys pressed into a single character).

Constructors

Link copied to clipboard
constructor(eventType: EventType<KeyEvent>, key: Key, scanCode: Int, repeated: Boolean, mods: Int)

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val key: Key

Which key was pressed / released.

Link copied to clipboard
val mods: Int

Holds state information for the Shift, Control, Alt and Super keys. See isShiftDown, isControlDown, isAltDown, isSuperDown.

Link copied to clipboard

For events of type EventType.KEY_PRESSED, which are generated due to a key is held down.

Link copied to clipboard

Keyboard specific identifier for the key pressed/released. This is rarely used, as key is a device-independent identifier.

Functions

Link copied to clipboard
fun matches(keyCombination: KeyCombination): Boolean
Link copied to clipboard
open override fun toString(): String