withKeyDown

Function

Common
fun KeyInjectionScope.withKeyDown(key: Key, block: KeyInjectionScope.() -> Unit)

Executes the keyboard sequence specified in the given block, whilst holding down the given key. This key must not be used within the block.

If the given key is already down, an IllegalStateException will be thrown.

Parameters

keyThe key to be held down during injection of the block.
blockSequence of KeyInjectionScope methods to be injected with the given key down.