Key Pressed Custom Action/Event?

I want to setup a bit of a sequence of actions.

I want to attach an action event to a key pressed on the keyboard. Which after pressing the key, a window showing a form appears.

In my case, this is for debugging QA purposes.

Here are the two examples;

  1. I want to press F11 and bring up a popup window that has various debug tools on it. This is for developer use.

This is referred to as a ‘debug menu’.

  1. Pressing F12 will bring up a Report form in a window. This is for users to report bugs that happen to them.

Again, this would be great for QA.

Any way I can do this?

HI John,

I don’t fully understand your use case, but you can register a keyboard shortcut using the window plugin.
https://wiki.servoy.com/display/DOCS/wi … methodName)

// i.e on form show first show
plugins.window.createShortcut(‘f11’, myMethod);

Note: Keep in mind that you are competing with the browser’s own shortcuts (i.e. f11 in chrome on windos is full screen mode). So pick something unique.

Best,
Sean

sean:
HI John,

I don’t fully understand your use case, but you can register a keyboard shortcut using the window plugin.
https://wiki.servoy.com/display/DOCS/wi … methodName)

// i.e on form show first show
plugins.window.createShortcut(‘f11’, myMethod);

Note: Keep in mind that you are competing with the browser’s own shortcuts (i.e. f11 in chrome on windos is full screen mode). So pick something unique.

Best,
Sean

Do button combos work? Like can I setup Ctrl + F1? Would that be,

plugins.window.createShortcut( ‘ctrl’ + ‘f1’, myMethod);

EDIT:

Ah, I see from that page you have put the full name.

So it would be ‘control F1’ ?

The plugins.window.createShortcut has a parameter consumeEvent, if you set that to true, you can consume/override the default browser action:

plugins.window.createShortcut('F11', myMethod, null, [event], true)

Ruben79:
The plugins.window.createShortcut has a parameter consumeEvent, if you set that to true, you can consume/override the default browser action:

plugins.window.createShortcut('F11', myMethod, null, [event], true)

I see! I’ll consider this.

Also, I noticed my problem was having the method, I was putting the method as ‘method()’, but as shown it’s ONLY the method’s name. Ooops!