What does it mean when a UICONTROL is in "focus" in MATLAB?

4 views (last 30 days)
I would like to know what the term "in focus" means for UICONTROL objects in MATLAB.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 25 Mar 2023
Edited: MathWorks Support Team on 27 Mar 2023
A UICONTROL such as a pushbutton is in focus when it is the last UICONTROL with which a user interacted or when the tab key is used to choose that UICONTROL. For a pushbutton, the dotted line around the pushbutton indicates that it is in focus.
Pressing the spacebar triggers the callback of the UICONTROL which is in focus. Note that a UICONTROL only becomes the current object when its callback is called. Clicking on pushbuttons, checkboxes, radiobuttons, sliders, listboxes and togglebuttons calls their callback, and sets them to be the current object. Edit controls, however, operate differently - they do not call their callback until they lose focus, or until you hit Enter.
For example, you can run your GUI and initially click on a UICONTROL to give it focus. When you press the Tab key, you can expect the GUI to tab through the other UICONTROLS.
Note that there is a bug in MATLAB 6.5 (R13) which does not display which UICONTROL receives focus. For more information, refer to the following solution:
For information on how to give focus to a particular UICONTROL, refer to the following solution:

More Answers (0)

Categories

Find more on Migrate GUIDE Apps in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!