Highlights
Segui


Adam Danz
19 visualizzazioni (ultimi 30 giorni)

New in MATLAB R2022a: Control keyboard focus to UI components

Adam Danz il 4 Apr 2022 (Modificato il 5 Apr 2022)
Ultime attività Replicato da goc3 il 6 Apr 2022

.

MATLAB R2022a provides app developers more control over user navigation through app components using the keyboard's Tab key.

Part 1. The new focus function: programmatically set keyboard focus to a UI component

Part 2. Modify focus order of components

Today we'll review Part 1. Come back tomorrow for Part 2.

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

Programmatically set UI component focus

Did you know that you can save ~2 seconds every time you use a keyboard shortcut rather than reaching for your mouse [1,2]?

I need you to focus here: starting in MATLAB R2022a, use the new focus function to set keyboard focus to a specific UI component.

By specifying the component handle ( c ) in focus(c),

  1. The figure containing the component is displayed
  2. A blue frame appears around the component
  3. The user can directly interact with the component.

.

Which components are focusable?

Focusable components are those that a user can interact with using the keyboard. So an object set to Enable='off' or Visible='off' cannot be in focus. See the documentation for more details.

What will you do with all of that extra time saved?

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

Stay tuned

Tomorrow we'll learn how to apply the new focus function with control of tab order to create contextual flow of UI component focus. Follow Community Highlights to get notifications.

Let us know what interests you in the new MATLAB R2022a release in the comment section below.

See also

Footnotes

[1] Lane et. al. (2005). International Journal of Human-Computer Interaction, 18(2).

[2] Michels (2018). median.com

This Community Highlight is attached as a live script.

goc3
goc3 il 6 Apr 2022

I like that you provided citations for the time saved by using keyboard shortcuts. I have long known that they saved time, but now I know how much!

Mario Malic
Mario Malic il 4 Apr 2022

Finally!