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.
Type: double | integer
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.
Type: string | vector
'callback'
Callback function that is triggered the value of the handle changes.
If value is a function handle, it must be a function that takes at least two arguments: the first is handle, and the second is the event data to the uispinbox. Compose passes empty data to the second argument if there is no data to the uispinbox.
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 callback function in the additional elements.
Type: cell | functionhandle | string
'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.
Type: cell | functionhandle | string
'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.
Type: cell | functionhandle | string
'enable'
Specifies if handle is enabled. Valid values are 'on'(default) and 'off'.
Type: string
'fontangle'
Specifies angle of the displayed font. Valid values are 'regular'(default) and 'italic'.
Type: string
'fontname'
Specifies name of the displayed font.
Type: string
'fontsize'
Specifies size of the displayed font.
Type: scalar
'fontunits'
Determines if fontsize property is absolute or relative based on fontsize of the parent of handle. Valid values are 'pixels' (default) or 'normalized'.
Type: string
'fontweight'
Specifies weight of the displayed font. Valid values are 'normal' (default) and 'bold'.
Type: string
'foregroundcolor'
Specifies the background color. Valid values are 'transparent' or a real vector specifying RGB values in the range 0-255 or 0-1.
Type: string | vector
'horizontalalignment'
Specifies the horizontal alignment of the text in uispinbox. Valid values are left(default), right, center and justify.
Type: string
'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'.
Type: string
'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.
Type: cell | functionhandle | string
'linestep'
Specifies the value of a single step when the handle is incremented or decremented.
Type: integer
'max'
Defines the maximum value that the handle can be incremented to.
Type: integer
'min'
Defines the minimum value that handle can be decremented to.
Type: integer
'parent'
Specifies the parent.
Type: scalar
'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.
Type: vector
'prefix'
Specifies the string prepended to the displayed value of handle.
Type: string
'style'
Read-only property with the type of handle, which is a uispinbox.
Type: string
'suffix'
Specifies the string appended to the displayed value of handle.
Type: string
'tag'
User-defined string to tag graphical control objects.
Type: string
'tooltipstring'
Tooltip to display.
Type: string
'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.
Type: string
'userdata'
User-defined numerical data.
Type: complex | mtx | scalar
'value'
Current value of handle.
Type: integer
'verticalalignment'
Specifies the vertical alignment of the text in uispinbox. Valid values are top, bottom and middle (default).
Type: string
'visible'
Specifies if handle is visible. Valid values are 'on'(default) and 'off'.
Type: string
'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'.
Type: string

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);