MATLAB Creating Graphical User Interfaces

(Barry) #1

10 Lay Out a Programmatic UI


3x1 UIControl array:

UIControl (Surf)
UIControl (Mesh)
UIControl (Contour)

The default tab order is the reverse of the child order: Contour, then Mesh, then Surf.

NoteDisplaying the children in this way shows only those children that have their
HandleVisibility property set to 'on'. Use allchild to retrieve children regardless of
their handle visibility.

In this example, the default order is pop-up menu followed by the panel's Contour,
Mesh, and Surf push buttons (in that order), and then back to the pop-up menu. You
cannot tab to the axes component or the static text component.

Try modifying the code to create the pop-up menu following the creation of the Contour
push button and before the Mesh push button. Now execute the code to create the UI
and tab through the components. This code change does not alter the default tab order.
This is because the pop-up menu does not have the same parent as the push buttons. The
figure is the parent of the panel and the pop-up menu.

Change the Tab Order in the uipanel


Get the Children property of the uipanel, and then modify the order of the array
elements. This code gets the children of the uipanel and stores it in the variable, ch.

ch = ph.Children

ch =

3x1 UIControl array:

UIControl (Surf)
UIControl (Mesh)
UIControl (Contour)

Next, call the uistack function to change the tab order of buttons. This code moves the
Mesh button up one level, making it the last item in the tab order.

uistack(ch(2),'up',1);
Free download pdf