uispinbox
Creates a spin box in a figure.
Syntax
handle = uispinbox()
handle = uispinbox(property, value, ...)
handle = uispinbox(parent, property, value, ...)
Inputs
- parent
- Handle of a container object, which could be a figure, frame, uipanel, or uibuttongroup.
- property, value
-
- 'backgroundcolor'
- Specifies the background color. Valid values are 'transparent' or a real vector specifying RGB values in the range 0-255 or 0-1.
- 'callback'
- Callback function that is triggered the value of the handle changes.
- 'createfcn'
- Function that is triggered when handle is created. If value is a function handle, it must be a function that takes at least two arguments. The first argument is the handlehandle of the uispinbox. The second argument is the event data to the uispinbox, which is ignored for createfcn. If value is a string, it must represent a function handle or a function name. If value is a cell, it must contain the function name/function handle in the first cell element and parameters to pass to callback function in the additional elements. After it is being executed, createfcn cannot be interrupted.
- 'deletefcn'
- Function that is triggered when handle is deleted. If value is a function handle, it must be a function that takes at least two arguments. The first argument is the handlehandle. The second argument is ignored. If value is a string, it must represent a function handle or a function name. If value is a cell, it must contain the function name/function handle in the first cell element and parameters to pass to callback function in the additional elements. After it is being executed, deletefcn cannot be interrupted.
- 'enable'
- Specifies if handle is enabled. Valid values are 'on'(default) and 'off'.
- 'fontangle'
- Specifies angle of the displayed font. Valid values are 'regular'(default) and 'italic'.
- 'fontname'
- Specifies name of the displayed font.
- 'fontsize'
- Specifies size of the displayed font.
- 'fontunits'
- Determines if fontsize property is absolute or relative based on fontsize of the parent of handle. Valid values are 'pixels' (default) or 'normalized'.
- 'fontweight'
- Specifies weight of the displayed font. Valid values are 'normal' (default) and 'bold'.
- 'foregroundcolor'
- Specifies the background color. Valid values are 'transparent' or a real vector specifying RGB values in the range 0-255 or 0-1.
- 'horizontalalignment'
- Specifies the horizontal alignment of the text in uispinbox. Valid values are left(default), right, center and justify.
- 'interruptible'
- Specifies if the callback associated with handle is interruptible by the user by clicking on the Stop button in the user interface. Valid values are 'off' (default) and 'on'.
- 'keypressfcn'
- Function that is triggered when there is a key is pressed on handle. If value is a function handle, it must be a function that takes two arguments. The first argument is the handlehandle. The second argument is the event data, which has details on the key pressed. If value is a string, it must represent a function handle or a function name. If value is a cell, it must contain the function name/function handle in the first cell element and parameters to pass to the function in the additional elements.
- 'linestep'
- Specifies the value of a single step when the handle is incremented or decremented.
- 'max'
- Defines the maximum value that the handle can be incremented to.
- 'min'
- Defines the minimum value that handle can be decremented to.
- 'parent'
- Specifies the parent.
- 'position'
- Position and size of h. Value is specified as a vector of form: [left top width height]. If 'units' has a value of 'normalized', values must be between 0 to 1.
- 'prefix'
- Specifies the string prepended to the displayed value of handle.
- 'style'
- Read-only property with the type of handle, which is a uispinbox.
- 'suffix'
- Specifies the string appended to the displayed value of handle.
- 'tag'
- User-defined string to tag graphical control objects.
- 'tooltipstring'
- Tooltip to display.
- 'units'
- Specifies units of measurement. Valid values are 'pixels'(default) and 'normalized'. Value 'pixel' indicates that handle has a fixed size and position specified by 'position'. Value 'normalized' indicates that h will be resized if parent is resized.
- 'userdata'
- User-defined numerical data.
- 'value'
- Current value of handle.
- 'verticalalignment'
- Specifies the vertical alignment of the text in uispinbox. Valid values are top, bottom and middle (default).
- 'visible'
- Specifies if handle is visible. Valid values are 'on'(default) and 'off'.
- 'wrapping'
- Specifies if handle is a circular spin box, where incrementing beyond the max value will reset the value to min and vice versa. Valid values are 'off'(default) and 'on'.
Outputs
- handle
- Handle of the uispinbox.
Examples
Create a spinbox with a prefix value:
handle = uispinbox('prefix', '$', 'value', 50);
Create a circular spinbox:
handle = uispinbox('wrapping', 'on', 'max', 50, 'min', 0, 'linestep', 5);