Community Highlights

커뮤니티 픽

Adam Danz
조회 수: 38 (최근 30일)

New in MATLAB R2022a: Control keyboard focus to UI components

Adam Danz 2022년 4월 4일 (2022년 4월 5일에 수정됨)
최근 활동 goc3답글 2022년 4월 6일

.

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 2022년 4월 6일

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 2022년 4월 4일

Finally!

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!