MATLAB Creating Graphical User Interfaces

(Barry) #1

10 Lay Out a Programmatic UI


Customize Tabbing Behavior in a Programmatic UI


In this section...
“How Tabbing Works” on page 10- 62
“Default Tab Order” on page 10- 62
“Change the Tab Order in the uipanel” on page 10- 64

How Tabbing Works


The tab order is the order in which components of the UI acquire focus when the user
presses the keyboard Tab key. Focus is generally denoted by a border or a dotted border.

Tab order is determined separately for the children of each parent. For example, child
components of the figure window have their own tab order. Child components of each
panel or button group also have their own tab order.

If, in tabbing through the components at one level, a user tabs to a panel or button group,
then the tabbing sequences through the components of the panel or button group before
returning to the level from which the panel or button group was reached. For example, if
a figure window contains a panel that contains three push buttons and the user tabs to
the panel, then the tabbing sequences through the three push buttons before returning to
the figure.

NoteYou cannot tab to axes and static text components. You cannot determine
programmatically which component has focus.

Default Tab Order


The default tab order for each level is the order in which you create the components at
that level.

The following code creates a UI that contains a pop-up menu with a static text label, a
panel with three push buttons, and an axes.

fh = figure('Position',[200 200 450 270]);
pmh = uicontrol(fh,'Style','popupmenu',...
'String',{'peaks','membrane','sinc'},...
Free download pdf