397 views
in Embedded Wizard Studio by

dialog config

dialog1

dialog2 : vertical list, text

dialog3 : text

-----------------------------------------

Screen 2 and Screen 3 each have their own key handlers.
To increase the font size when the enter key is pressed, it is converted to Application::Font->Application::FontLarge.
In screen 2, it works fine, but in screen 3, it doesn't work when I press the enter key, but when I change the key to another key such as f1, it works.
How can I make it work when the same enter key is pressed?
Is there something I'm missing out on?
Thank you in advance.

1 Answer

0 votes
by

Hello sukyeong,
When using a key handler the key events are passed to the handers along the focus path. As soon as a handler consumes the key, it is no longer passed to the other handlers. If you want to pass the key event also to other handlers, please use the KeyHandler.Continue property accordingly.

With kind regards,
Rudolf

by
Each screen has its own keyhandler. When you press the same key on the screen, each plays a different role. The role is executed on screen 2 and not on screen 3. Screen 2 is placed on the bottom stack on screen 3, could it be a problem?
by
If the key handler on screen 2 is consuming the key event, it is no longer passed to the key handler within screen 3. Please use the 'Continue' property.
by
It seems that there was an error in the description while I was translating.

I don't want to pass the key handler content to screen3.
Screen 3 wants to have a different action from the screen 2 event without forwarding it.
by
Can you please send your project or a short part of it. This might help to understand your issue.
by

 

I can't seem to attach a photo....

In screen 1, the enter key works fine, but in screen 2, the enter key does not work.

by

 

In screen 1, the enter key works fine, but in screen 2, the enter key does not work.

A screen transition occurs between screen 1 and screen 2. I think it's because screen 2 includes screen 1. Is there any way to solve it?

This slot is used when the button is pressed. 

if ( IsCurrentDialog()) 
GetRoot().ActiveDialogClass = Application::SCREEN2Dialog;

 

by
When you change the ActiveDialogClass to Application::SCREEN2Dialog, a the job to add an instance of Application::SCREEN2Dialog is created. At this moment the new instance of Application::SCREEN2Dialog it not jet part of the root tree and will not receive any KeyEvents.

New KeyEvents can be received after the dialog is presented.
by
  • So is it a good idea to use menu items when you have a lot of dialogs?
    Can I use the switch to dialog function?
by

Which architecture to choose depends on your requirements. In principle it is not a good idea to handle one KeyEvent within different classes. Here a 'global' key handler within the application might be better. This one can change things like the 'font size' within a property and each class using this information can listen for a change using eg. a property observer.

For alternative architectures you can have a look on one of our MasterClass videos.

by
The video is very informative. thank you for telling me.

Embedded Wizard Website | Privacy Policy | Imprint

...