User`s guide
11 Lay Out a Programmatic GUI
also distribute the components evenly across their span or specify a fixed
distance between them.
A syntax for the
align function is
align(HandleList,'HorizontalAlignment','VerticalAlignment')
The following table lists the possible values for these parameters.
HorizontalAlignment VerticalAlignment
None, Left, Center, Rig ht,
Distribute,orFixed
None
, To p, Middle, Bottom,
Distribute,orFixed
All h andles in HandleList must have the same parent. See the align
reference page for information about other syntaxes.
The
align function positions components with respect to their bounding box,
shown as a blue dashed line in the following figures. For demonstration
purposes, create three push buttons in arbitrary places using the following
code.
fh = figure('Position',[400 300 300 150])
b1 = uicontrol(fh,'Posit',[30 10 60 30],'Strin g','Button 1');
b2 = uicontrol(fh,'Posit',[50 50 60 30],'Strin g','Button 2');
b3 = uicontrol(fh,'Posit',[10 80 60 30],'Strin g','Button 3');
11-54