KeyPressLearn Op


Triggers when certain key is pressed or released

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

Edit Documentation
Full Name
  • Ops.Devices.Keyboard.KeyPressLearn
  • Core Op - Official cables op
  • MIT
AuthorTest Patches


key code (Number:integer )

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 to find out the key code you are looking for.

canvas only (Number:boolean )

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 index (Number:integer )
Enabled (Number:boolean )
Prevent Default (Number:boolean )

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

learn (Trigger)

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.


on press (Trigger)

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

on release (Trigger)

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

Pressed (boolean Number)

True if the key is currently pressed, false otherwise

Key (String)

Patches using KeyPressLearn

  • Examples
  • Public
  • My Patches


added key-name to extended title and outportuser avatarstephan - 2022-03-16 16:25