ToolbarStateButton - Axes toolbar state button appearance and behavior - MATLAB (original) (raw)
ToolbarStateButton Properties
Axes toolbar state button appearance and behavior
ToolbarStateButton
properties control the appearance and behavior of the axes ToolbarStateButton
object. By changing property values, you can modify certain aspects of the state button.
tb = axtoolbar('default') btn = axtoolbarbtn(tb,'state') btn.Tooltip = 'My State Button';
Button icon, specified as one of these values. The axes toolbar displays icons as grayscale images. MATLAB® scales down the image to fit, if necessary.
- File name — Specify the file name as a character vector or a string scalar. The file name can be preceded by a path. The image file must be in JPEG, GIF, or PNG format.
- Array — Specify an m-by-n-by-3 array of RGB triplets that represent pixels in an image.
- Matrix — Specify an m-by-n matrix of numeric values that represent pixels in an image.
- If the values are of an integer type, then specify values between
0
and63
. A value of0
is opaque and a value of63
is transparent.NaN
is also transparent. - If the values are of type
double
, then specify values between1
and64
. A value of1
is opaque and a value of64
is transparent.NaN
is also transparent.
- If the values are of an integer type, then specify values between
- Predefined icon — Specify one of the names in this table.
Icon Name Result 'brush' 'datacursor' 'export' 'rotate' 'pan' 'zoomin' 'zoomout' 'restoreview' 'none' No icon
Example: btn.Icon = 'icon.png'
Example: btn.Icon = 'C:\Documents\icon.png'
Example: btn.Icon = 'rotate'
Button tool tip, specified as a character vector, cell array of character vectors, or a string array. Use this property to display a message when you hover the pointer over the button. To display multiple lines of text, specify a cell array of character vectors or a string array. Each element in the array displays a separate line of text.
Example: btn.Tooltip = 'My Tooltip'
Current state of the button, specified as 'on'
or'off'
, or as numeric or logical 1
(true
) or 0
(false
). A value of 'on'
is equivalent to true
, and'off'
is equivalent to false
. Thus, you can use the value of this property as a logical value. The value is stored as an on/off logical value of type matlab.lang.OnOffSwitchState.
'on'
– The button is pressed.'off'
– The button is not pressed.
Callbacks
State button callback that executes when you click the button, specified as one of these values:
- A function handle.
- A cell array in which the first element is a function handle. Subsequent elements in the cell array are the arguments to pass to the callback function.
- A character vector containing a valid MATLAB expression (not recommended). MATLAB evaluates this expression in the base workspace.
This callback executes when you click a state button. It does not execute if a state button Value
property changes programmatically.
If you specify this property using a function handle, then MATLAB passes the source StateButton
object and an event data structure as the first and second input arguments to the function. This table describes the fields in the event data structure.
Field | Description |
---|---|
Source | StateButton object |
Axes | Associated Axes object |
EventName | 'ValueChanged' |
Value | Current value (either 'on' or'off') |
PreviousValue | Previous value (either 'on' or'off') |
Callback Execution Control
This property is read-only.
Parent/Child
Parent container, specified as an AxesToolbar
object.
This object has no children. You cannot set this property.
Identifiers
This property is read-only.
Type of graphics object, returned as 'toolbarstatebutton'
.
Object identifier, specified as a character vector or string scalar. You can specify a unique Tag
value to serve as an identifier for an object. When you need access to the object elsewhere in your code, you can use the findobj function to search for the object based on the Tag
value.
Unused Properties
Setting this property has no effect on objects of this type.
Mouse-click callback, specified as a function handle, a cell array, or a character vector.
Note
The button does not use this property.
Version History
Introduced in R2018b