488 views
in GUI Development by
I have 2 GUI components that each have their own unique KeyPressHandlers:

Application::Top that responds to the cursor keys for simple menu navigation on the top half of the screen.

Application::Bottom that responds to the number keys 1-4 to perform actions on the bottom half of the screen.

When I prototpye these GUI Components individually they work as expected.

 

When I then add these 2 GUI components to my main application and then prototype the application class only the componet with the lowest order number works. How do I get both GUI components to respond to their KeyPressHandlers? Thanks!

2 Answers

0 votes
by

Hello,

the reason for the described behavior is, that all keyboard events are routed along the focus path - let me refer to the chapter Keyboard events and the focus path.

The component with the lowest order is by default the focused component and reacts on the keyboard events. The other component is not focused and will not receive any keyboard events.

Due to this concept it is possible to naviagte through a complex / cascaded UI structure and show the user where the input focus is (by managing the component state). 

In your case, if you want to react within both embedded components on keyboard events, you need to place the KeyPressHandler into the main component and forward the event.

Best regards,

Manfred.

0 votes
by

Hello,

see also the chapter Reject the just received key press event. With the technique described there you can have more than one key-handler being able to receive the same 'press' event - as long as all handler are on the focus path.

Best regards

Paul banach 

Ask Embedded Wizard

Welcome to the question and answer site for Embedded Wizard users and UI developers.

Ask your question and receive answers from the Embedded Wizard support team or from other members of the community!

Embedded Wizard Website | Privacy Policy | Imprint

...