Function reference previous pagenext page

2.1: uiextras.HBox Go back up one level


Arrange elements horizontally in a single row

obj = uiextras.HBox( )
creates a new horizontal box layout with all properties set to defaults. The output is a new layout object that can be used as the parent for other user-interface components.
obj = uiextras.HBox( prop, value, ... )
also sets one or more property values.

uiextras.HBox properties

PropertyValueDescription
BackgroundColor colorspecThe color to use for exposed areas of the layout background. This can be an RGB triple (e.g. [0 0 1]) or a colour name (e.g. 'b').
BeingDeleted [ on | off ]is the object in the process of being deleted.
Children handle arrayList of child objects within this layout (note that this can only be set to permutations of itself).
DeleteFcn function_handleFunction to call when the layout is being deleted
Enable [ on | off ]Is interaction with this layout enabled? Note that changing the enable property will cause all children contained to also be enabled/disabled, however since they can be individually re-enabled the state of this property does not reflect the state of the children. See the enable example for more details.
MinimumSizes double vectorThe minimum size in pixels for each of the child elements. The size of this vector must always match the number of elements (children).
Padding positive integerNumber of pixels of extra space around the outside of the layout.
Parent handleThe handle of the parent figure or container.
Position [x y w h]The position (x,y) and size (w,h) of the layout.
Sizes double vectorThe size of each of the child elements. Positive entries indicate fixed sizes in pixels, negative values indicate relative weights for resizing. The size of this vector must always match the number of elements (children).
Spacing positive integerNumber of pixels of extra space to leave between elements in the layout.
Tag stringA string that can be used to identify this object later.
Type stringthe object type (class).
Units [ inches | centimeters | normalized | points | pixels | characters ]The units of measurement for position the layout within its parent.
Visible [ on | off ]Is the object visible on screen.

For example:

f = figure();
b = uiextras.HBox( 'Parent', f );
uicontrol( 'Parent', b, 'Background', 'r' )
uicontrol( 'Parent', b, 'Background', 'b' )
uicontrol( 'Parent', b, 'Background', 'g' )
set( b, 'Sizes', [-1 100 -2], 'Spacing', 5 );

f = figure();
b1 = uiextras.VBox( 'Parent', f );
uicontrol( 'Parent', b1, 'Background', 'r' )
b2 = uiextras.HBox( 'Parent', b1, 'Padding', 5, 'Spacing', 5 );
uicontrol( 'Parent', b2, 'String', 'Button1' )
uicontrol( 'Parent', b2, 'String', 'Button2' )
set( b1, 'Sizes', [30 -1] );


See also:
© 2014 The MathWorks Ltd Terms of Use Patents Trademarks