Is there is any provision to use combination of keys like if i press Up and Down at same time, to do some operation??

asked Nov 25, 2019 in GUI Development by Chaitra

1 Answer

0 votes
answered Nov 25, 2019 by Paul Banach

Hello Chaitra,

from Embedded Wizard point of view there are only single key events existing. Even if you consider the combination of keys CTRL + SHIFT + C, these are reported as single code KeyCode::CtrlShiftKeyC. If you try to feed two key events simultanously, the second event will cause the preceding event to be finalized first. This behaviour is similar to how regular PC keyboard is working. If you press the key UP and then additionally the key DOWN, the keyboard will continue sending events for the last one.

What can you do?

You can map the combination of UP+DOWN to a special code (similarly to the above example CTRL+SHIFT+C being mapped to CtrlShiftKeyC). For this purpose, the list of possible keycodes provides a range of user codes User0 .. User19. When your keyboard driver (or other code responsable for detecting the UP/DOWN buttons) recognizes that both UP and DOWN are pressed, just feed Embedded Wizard with the code e.g. User0. Thereupon the key handler configured with User0 will react to this event. Please see the article Implementing the Main Loop. It explaines how key events are fed in to the GUI application. 

If you are using a keyboard, please note that the keyboard is really able to send the UP and DOWN events independently.

Does it help you?

Best regards

Paul Banach

Embedded Wizard Website | Privacy Policy | Imprint