beta
cables is under heavy development.
There might be one or another bug, please let us know about it!
Ops.Devices.Keyboard.KeyPressLearn

KeyPressLearn
op id:f069c0db-4051-4eae-989e-6ef7953787fd
triggers when certain key is pressed or released

summary (oneliner)

Can be used to trigger on a certain key press. Press the Learn button and then press a certain key – you should see the Key Code value change.
Once the op has learned a certain key it will trigger on the On Press port once the key is pressed.
You can also decide weather or not key events in the whole document or only inside the canvas should trigger by setting the Canvas Only checkbox.
Please note, that the key values of KeyPressLearn differ from the Ops.Devices.Keyboard.KeyPress op.
Here you will find a table listing all keys and there key codes: Javascript Key Codes

doc

youtube id

op collections: hardware  

collections

relatedops:  

related ops

Inputs

learn (Function)

Press learn and directly afterwards (3 Seconds) press a key, this one will from now on trigger on the output port On Press once the key has been pressed.


key code (integer Number)

In most cases you won’t have to use this directly, just use the Learn button. It contains the key code on which to respond. You can use keycode.info to find out the key code you are looking for.


canvas only (boolean Number)

If you want to only trigger when a key has been pressed while the canvas has the focus (when you clicked in the canvas before) use true. If you want key presses to trigger even if the canvas is not in focus set it to false (global mode).


Mod Key (string Number)

Enabled (boolean Number)

Prevent Default (boolean Number)

Prevent that other key listeners (parents) are informed on the key press


Outputs

on press (Function)

Triggers every time the learned key is pressed down (and also triggers while it is hold down).


on release (Function)

Triggers every time the learned key is released (once).


Pressed (Number)

True if the key is currently pressed, false otherwise


Credits

Caught a mistake or want to contribute to the documentation?


Edit this documentcancel save

Examples using KeyPressLearn

Public Patches using KeyPressLearn