Function_reference |

## 2.5: uix.HButtonBox

Arrange buttons horizontally in a single row

`obj``= uix.HButtonBox(``)`
  is a type of HBox specialised for arranging a row of buttons, check-boxes or similar graphical elements. All buttons are given equal size and by default are centered in the drawing area. The justification can be changed as required.
`obj``= uix.HButtonBox(``prop``,``value``,``...``)`
  also sets one or more property values.

### uix.HButtonBox properties

Property | Value | Description
--- | --- | ---
`BackgroundColor` | `colorspec` | 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 | Deletion status.
`ButtonSize` | [w h] | The size for the buttons (all are given equal size).
`Contents` | empty GraphicsPlaceholder array | array of graphics objects | Children within this layout, regardless of HandleVisibility. Note that this can only be set to permutations of itself.
`DeleteFcn` | `function_handle` | Function to call when the layout is being deleted.
`HorizontalAlignment` | left | center | right | The horizontal position of the buttons.
`Padding` | positive integer | Number of pixels of extra space around the outside of the layout.
`Parent` | empty GraphicsPlaceholder array | figure | container | Parent of the layout.
`Position` | [x y w h] | Position (x,y) and size (w,h) within figure or container.
`Spacing` | positive integer | Number of pixels of extra space to leave between elements in the layout.
`Tag` | string | Tag to associate with layout.
`Type` | string | Type of graphics object.
`Units` | inches | centimeters | normalized | points | pixels | characters | Position units.
`VerticalAlignment` | top | middle | bottom | The vertical position of the buttons.
`Visible` | on | off | Visibility.

### For example:

    f = figure();
    b = uix.HButtonBox( 'Parent', f );
    uicontrol( 'Parent', b, 'String', 'One' );
    uicontrol( 'Parent', b, 'String', 'Two' );
    uicontrol( 'Parent', b, 'String', 'Three' );
    set( b, 'ButtonSize', [130 35], 'Spacing', 5 );

See also:

- `uix.VButtonBox` - for creating a vertical arrangement of buttons
- `uix.HBox` - for creating a general horizontal arrangement

© 2024 The MathWorks Ltd `•` Terms of Use `•` Patents `•` Trademarks