293 views
in GUI Development by
Hello,

I am curious about how the view state focused is handled when dialogs are also used.

When there is no dialog (Group does not have the dialogStack variable and related methods), the focus chain is straight-forward. Following the Focus property of the Group, and the leaf view is set as view state "focused", which is unique in the application.

When there are dialogs, is the focus chain supposed to cover the dialogs?

 

Suppose we have a Root view; it has subviews GroupA (top of viewStack), GroupB (in viewStack), and GroupC (Focus). These groups have similar subviews. Which view(s) are supposed to be in the view state "focused"? GroupA1 and GroupC1?

Root

{

  viewStack.group = GroupA

  {

    viewStack.group = GroupA1,

    viewStack.next.group = GroupA2,

    Focus = GroupA3

  },

  viewStack.next.group = GroupB

  {

    viewStack.group = GroupB1,

    viewStack.next.group = GroupB2,

    Focus = GroupB3

  },

  Focus = GroupC

  {

    viewStack.group = GroupC1,

    viewStack.next.group = GroupC2,

    Focus = GroupC3

  }

}

1 Answer

0 votes
by

Hello Gloria,

this is a very exciting question. To answer it we have to consider the focus path and following description from the section Take a closer look at the Dialog functionality:

 

According to this description, if there is a dialog presented within a component X the dialog will receive all keyboard events at first. If the keyboard event is still not handled, the event is delivered to the component Y focused within X (if any). This is because X itself lies on the focus path and Y is focused within X. In the screenshot above, the user can control the top-level menu dialog as well as the button Lock. The menu, however, will have the possibility to handle the keyboard event first.

Considering now your concrete scenario following components will lie on the focus path and will be able to react to keyboard events. These components are focused. If a keyboard event arrives, the event is dispatched in following order:

1. GroupA1, 2. GroupA3, 3. GroupA, 4. GroupC1, 5. GroupC3, 6. GroupC, 7. Root

Does it help you further?

Best regards

Paul Banach

by
Thanks Paul! It's like a post-order traversal.

If I want to highlight the first one receiving the key event, i.e. GroupA1, can I rely on view state "focused"? Are these 7 components all in the "focused" view state?
by
Hello,

yes, all views that are able to react to keyboard events (which lie on the focus path) are focused. You can rely on the focused state.

Best regards

Paul Banach
by
Thanks a lot! There's much to explore about focus :)

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

...