Control button group appearance and behavior in
figure
-based apps
The properties listed here are valid for button groups in
GUIDE or in apps created with the figure
function. If you are using App Designer or the
uifigure
function, see ButtonGroup Properties
instead. For more information, see GUIDE Migration Strategies.
Button groups are containers for managing exclusive selection of radio buttons and toggle buttons. Properties control the appearance and behavior of a button group. Use dot notation to refer to a specific object and property.
f = figure; b = uibuttongroup(f); b.BackgroundColor = [.5 .5 .5];
Title
— TitleTitle, specified as a character vector, string scalar, or categorical array. If you specify this property as a categorical array, MATLAB® displays only the first element in the array.
MATLAB does not interpret a vertical slash ('|'
) character as
a line break, it displays as a vertical slash in the title.
If you want to specify a Unicode® character, pass the Unicode decimal
code to the char
function.
For example, ['Multiples of ' char(960)]
displays
as Multiples of
π.
TitlePosition
— Title location'lefttop'
(default) | 'centertop'
| 'righttop'
| 'leftbottom'
| 'centerbottom'
| 'rightbottom'
Title location, specified as 'lefttop'
,
'centertop'
, 'righttop'
,
'leftbottom'
, 'centerbottom'
, or
'rightbottom'
.
ForegroundColor
— Title color[0 0 0]
(default) | RGB triplet | hexadecimal color code | 'r'
| 'g'
| 'b'
| ...Title color, specified as an RGB triplet, a hexadecimal color code, or one of the color options listed in the table.
RGB triplets and hexadecimal color codes are useful for specifying custom colors.
An RGB triplet is a three-element row vector whose elements specify the
intensities of the red, green, and blue components of the color. The intensities
must be in the range [0,1]
; for example, [0.4 0.6
0.7]
.
A hexadecimal color code is a character vector or a string scalar that starts
with a hash symbol (#
) followed by three or six hexadecimal
digits, which can range from 0
to F
. The
values are not case sensitive. Thus, the color codes
'#FF8800'
, '#ff8800'
,
'#F80'
, and '#f80'
are
equivalent.
Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.
Color Name | Short Name | RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|---|---|
'red' | 'r' | [1 0 0] | '#FF0000' | |
'green' | 'g' | [0 1 0] | '#00FF00' | |
'blue' | 'b' | [0 0 1] | '#0000FF' | |
'cyan' | 'c' | [0 1 1] | '#00FFFF' | |
'magenta' | 'm' | [1 0 1] | '#FF00FF' | |
'yellow' | 'y' | [1 1 0] | '#FFFF00' | |
'black' | 'k' | [0 0 0] | '#000000' | |
'white' | 'w' | [1 1 1] | '#FFFFFF' |
Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.
RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|
[0 0.4470 0.7410] | '#0072BD' | |
[0.8500 0.3250 0.0980] | '#D95319' | |
[0.9290 0.6940 0.1250] | '#EDB120' | |
[0.4940 0.1840 0.5560] | '#7E2F8E' | |
[0.4660 0.6740 0.1880] | '#77AC30' | |
[0.3010 0.7450 0.9330] | '#4DBEEE' | |
[0.6350 0.0780 0.1840] | '#A2142F' |
Example: [0 0 1]
Example: 'b'
Example: 'blue'
BackgroundColor
— Background color[.94 .94 .94]
(default) | RGB Triplet | hexadecimal color code | 'r'
| 'g'
| 'b'
| ...Background color, specified as an RGB triplet, a hexadecimal color code, or one of the color options listed in the table.
RGB triplets and hexadecimal color codes are useful for specifying custom colors.
An RGB triplet is a three-element row vector whose elements specify the
intensities of the red, green, and blue components of the color. The intensities
must be in the range [0,1]
; for example, [0.4 0.6
0.7]
.
A hexadecimal color code is a character vector or a string scalar that starts
with a hash symbol (#
) followed by three or six hexadecimal
digits, which can range from 0
to F
. The
values are not case sensitive. Thus, the color codes
'#FF8800'
, '#ff8800'
,
'#F80'
, and '#f80'
are
equivalent.
Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.
Color Name | Short Name | RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|---|---|
'red' | 'r' | [1 0 0] | '#FF0000' | |
'green' | 'g' | [0 1 0] | '#00FF00' | |
'blue' | 'b' | [0 0 1] | '#0000FF' | |
'cyan' | 'c' | [0 1 1] | '#00FFFF' | |
'magenta' | 'm' | [1 0 1] | '#FF00FF' | |
'yellow' | 'y' | [1 1 0] | '#FFFF00' | |
'black' | 'k' | [0 0 0] | '#000000' | |
'white' | 'w' | [1 1 1] | '#FFFFFF' |
Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.
RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|
[0 0.4470 0.7410] | '#0072BD' | |
[0.8500 0.3250 0.0980] | '#D95319' | |
[0.9290 0.6940 0.1250] | '#EDB120' | |
[0.4940 0.1840 0.5560] | '#7E2F8E' | |
[0.4660 0.6740 0.1880] | '#77AC30' | |
[0.3010 0.7450 0.9330] | '#4DBEEE' | |
[0.6350 0.0780 0.1840] | '#A2142F' |
BorderType
— Border type'etchedin'
(default) | 'etchedout'
| 'beveledin'
| 'beveledout'
| 'line'
| 'none'
Border type, specified as 'etchedin'
, 'none'
,
'etchedout'
, 'beveledin'
,
'beveledout'
, or 'line'
.
For a 3-D appearance, use etched or beveled borders.
Use the HighlightColor
and
ShadowColor
properties to specify the color of 3-D
borders.
For a simpler appearance, use a line border.
Use the HighlightColor
property to specify the line
border color.
BorderWidth
— Border widthBorder width, specified as a positive integer value. The unit of measurement is pixels. Etched and beveled borders wider than three pixels might not appear correctly at the corners.
HighlightColor
— Border highlight color'r'
| 'g'
| 'b'
| ...Border highlight color, specified as an RGB triplet, a hexadecimal color code, or one of the color options listed in the table.
RGB triplets and hexadecimal color codes are useful for specifying custom colors.
An RGB triplet is a three-element row vector whose elements specify the
intensities of the red, green, and blue components of the color. The intensities
must be in the range [0,1]
; for example, [0.4 0.6
0.7]
.
A hexadecimal color code is a character vector or a string scalar that starts
with a hash symbol (#
) followed by three or six hexadecimal
digits, which can range from 0
to F
. The
values are not case sensitive. Thus, the color codes
'#FF8800'
, '#ff8800'
,
'#F80'
, and '#f80'
are
equivalent.
Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.
Color Name | Short Name | RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|---|---|
'red' | 'r' | [1 0 0] | '#FF0000' | |
'green' | 'g' | [0 1 0] | '#00FF00' | |
'blue' | 'b' | [0 0 1] | '#0000FF' | |
'cyan' | 'c' | [0 1 1] | '#00FFFF' | |
'magenta' | 'm' | [1 0 1] | '#FF00FF' | |
'yellow' | 'y' | [1 1 0] | '#FFFF00' | |
'black' | 'k' | [0 0 0] | '#000000' | |
'white' | 'w' | [1 1 1] | '#FFFFFF' |
Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.
RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|
[0 0.4470 0.7410] | '#0072BD' | |
[0.8500 0.3250 0.0980] | '#D95319' | |
[0.9290 0.6940 0.1250] | '#EDB120' | |
[0.4940 0.1840 0.5560] | '#7E2F8E' | |
[0.4660 0.6740 0.1880] | '#77AC30' | |
[0.3010 0.7450 0.9330] | '#4DBEEE' | |
[0.6350 0.0780 0.1840] | '#A2142F' |
ShadowColor
— Border shadow color'r'
| 'g'
| 'b'
| ...Border shadow color, specified as an RGB triplet, a hexadecimal color code, or one of the color options listed in the table.
RGB triplets and hexadecimal color codes are useful for specifying custom colors.
An RGB triplet is a three-element row vector whose elements specify the
intensities of the red, green, and blue components of the color. The intensities
must be in the range [0,1]
; for example, [0.4 0.6
0.7]
.
A hexadecimal color code is a character vector or a string scalar that starts
with a hash symbol (#
) followed by three or six hexadecimal
digits, which can range from 0
to F
. The
values are not case sensitive. Thus, the color codes
'#FF8800'
, '#ff8800'
,
'#F80'
, and '#f80'
are
equivalent.
Alternatively, you can specify some common colors by name. This table lists the named color options, the equivalent RGB triplets, and hexadecimal color codes.
Color Name | Short Name | RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|---|---|
'red' | 'r' | [1 0 0] | '#FF0000' | |
'green' | 'g' | [0 1 0] | '#00FF00' | |
'blue' | 'b' | [0 0 1] | '#0000FF' | |
'cyan' | 'c' | [0 1 1] | '#00FFFF' | |
'magenta' | 'm' | [1 0 1] | '#FF00FF' | |
'yellow' | 'y' | [1 1 0] | '#FFFF00' | |
'black' | 'k' | [0 0 0] | '#000000' | |
'white' | 'w' | [1 1 1] | '#FFFFFF' |
Here are the RGB triplets and hexadecimal color codes for the default colors MATLAB uses in many types of plots.
RGB Triplet | Hexadecimal Color Code | Appearance |
---|---|---|
[0 0.4470 0.7410] | '#0072BD' | |
[0.8500 0.3250 0.0980] | '#D95319' | |
[0.9290 0.6940 0.1250] | '#EDB120' | |
[0.4940 0.1840 0.5560] | '#7E2F8E' | |
[0.4660 0.6740 0.1880] | '#77AC30' | |
[0.3010 0.7450 0.9330] | '#4DBEEE' | |
[0.6350 0.0780 0.1840] | '#A2142F' |
Clipping
— Child component clipping (not recommended)'on'
(default) | on/off logical valueNote
The behavior of the Clipping
property
has changed. It no longer has any effect on
ButtonGroup
objects. Child
objects are now clipped to the boundaries of their parent
container regardless of the value of this property. This
property might be removed in a future release.
FontName
— Font name'FixedWidth'
Font name, specified as a system supported font name or
'FixedWidth'
. The default font depends on the specific operating
system and locale.
To use a fixed-width font that looks good in any locale,
specify 'FixedWidth'
. The actual fixed-width font used depends on the
FixedWidthFontName
property of
the root object. Changing the FixedWidthFontName
property causes an
immediate update of the display to use the new font.
Example: 'Arial'
FontSize
— Font sizeFont size, specified as a positive number. The FontUnits
property
specifies the units. The default size is system-dependent.
Example: 12
Example: 12.5
FontWeight
— Font weight'normal'
(default) | 'bold'
Font weight, specified as a value from the following table.
'normal'
— Default weight
as defined by the particular font
'bold'
— Thicker character
outlines than normal
MATLAB uses the FontWeight
property
to select a font from those available on your system. Not all fonts
have a bold font weight. Therefore, specifying a bold font weight
still can result in the normal font weight.
Note
The 'light'
and 'demi'
font weight
values have been removed in R2014b. If you specify either of these values, the
result is a normal font weight.
FontAngle
— Font angle'normal'
(default) | 'italic'
Font angle, specified as 'normal'
or 'italic'
.
MATLAB uses this property to select a font from those available on your system.
Setting this property to 'italic'
selects a slanted version of the
font, if it is available on your system.
Note
The 'oblique'
value has been removed. Use
'italic'
instead.
FontUnits
— Font units'points'
(default) | 'normalized'
| 'inches'
| 'centimeters'
| 'pixels'
Font units, specified as one of the values from this table.
Units Value | Description |
---|---|
'points' | Points. One point is 1/72nd of an inch. |
'normalized' | Normalized values for specifying the font size as a fraction of the height. When you resize a UI component, MATLAB scales the displayed font to maintain that fraction. |
'inches' | Inches. |
'centimeters' | Centimeters. |
'pixels' | Pixels. Starting in R2015b, distances in pixels are independent of your system resolution on Windows® and Macintosh systems:
On Linux® systems, the size of a pixel is determined by your system resolution. |
Visible
— State of visibility'on'
(default) | on/off logical valueState of visibility, 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'
— Display the object.
'off'
— Hide the object without deleting it. You
still can access the properties of an invisible UI component.
To make your app start faster, set the Visible
property to
'off'
for all components that do not need to appear at
startup.
Changing the size of an invisible container triggers the
SizeChangedFcn
callback when it becomes visible.
Changing the Visible
property of a container does
not change the values of the Visible
properties of child components. This is true even though hiding the container causes the
child components to be hidden.
ContextMenu
— Context menuGraphicsPlaceholder
array (default) | ContextMenu
objectContext menu, specified as a ContextMenu
object created using the uicontextmenu
function. Use this property to display a context menu when
you right-click on a component.
SelectedObject
— Currently selected radio button or toggle buttonUIControl
object | []
Currently selected radio button or toggle button, specified as a
UIControl
object.
Use this property to determine the currently selected button
within a button group. You can also use this property to set a
default button selection. If you want no selection, then set
this property to []
.
The default value of the SelectedObject
property is the first radio button or toggle button that you add
to the button group.
Note
The SelectionChangedFcn
callback does
not execute when you set the
SelectedObject
property
programmatically.
Selected
— Selection state (not recommended)'off'
(default) | on/off logical value
Note
The behavior of the Selected
property changed in R2014b,
and it is not recommended. It no longer has any effect on objects of this type.
This property might be removed in a future release.
SelectionHighlight
— Display of selection handles (not recommended)'on'
(default) | on/off logical value
Note
The behavior of the SelectionHighlight
property changed in R2014b, and it is not recommended. It no
longer has any effect on objects of this type. This property
might be removed in a future release.
Position
— Location and size (including borders and title)[left bottom width height]
Location and size (including borders and title), specified as a
four-element vector of the form [left bottom width
height]
. This table describes each element in
the vector.
Element | Description |
---|---|
left | Distance from the inner left edge of the parent container to the outer left edge of the button group |
bottom | Distance from the inner bottom edge of the parent container to the outer bottom edge of the button group |
width | Distance between the right and left outer edges of the button group |
height | Distance between the top and bottom outer edges of the button group |
All measurements are in units specified by the
Units
property.
Note
The Position
values are relative to the
parent container’s drawable area. The
drawable area is the area inside the borders of the container and
does not include the area occupied by the title. If the parent container
is a figure, then the drawable area also excludes the menu bar and
tool bar.
You can combine dot notation and array indexing when you
want to change one value in the
Position
vector. For example,
this code sets the width to
0.5
:
b = uibuttongroup; b.Position(3) = 0.5; b.Position
ans = 0 0 0.5000 1.0000
InnerPosition
— Location and size (excluding borders and title)[left bottom width height]
This property is read-only.
Location and size (excluding borders and title), returned as a
four-element vector of the form [left bottom width
height]
. This table describes each element in
the vector.
Value | Description |
---|---|
left | Distance from the inner left edge of the parent container to the inner left edge of the button group. |
bottom | Distance from the inner bottom edge of the parent container to the inner bottom edge of the button group. |
width | Distance between the inner edges of the button group's right and left borders. |
height | Distance between the inner edges of the button group's top and bottom borders. This distance excludes the title, if it exists. |
All measurements are in units specified by the
Units
property.
Note
These are some important points to consider when
using the InnerPosition
property:
InnerPosition
values
are affected by the presence of a title, font
characteristics, BorderType
,
and BorderWidth
.
InnerPosition
values
are relative to the parent container’s
drawable area. The drawable
area is the area inside the borders of the
container and exclude the area occupied by the
title. If the parent container is a figure, then
the drawable area also excludes the menu bar and
tool bar.
OuterPosition
— Location and size (including borders and title)[left bottom width height]
Location and size (including borders and title), specified as a four-element vector of
the form [left bottom width height]
. All measurements are in units
specified by the Units
property.
This property value is identical to the Position
property
value.
Units
— Units of measurement'normalized'
(default) | 'pixels'
| 'inches'
| 'centimeters'
| 'points'
| 'characters'
Units of measurement, specified one of the values from this table.
Units Value | Description |
---|---|
'normalized' | These units are normalized with respect to the parent container.
The lower-left corner of the container maps to (0,0) and
the upper-right corner maps to (1,1) . |
'pixels' | Pixels. Starting in R2015b, distances in pixels are independent of your system resolution on Windows and Macintosh systems:
On Linux systems, the size of a pixel is determined by your system resolution. |
'inches' | Inches. |
'centimeters' | Centimeters. |
'points' | Points. One point equals 1/72nd of an inch. |
'characters' | These units are based on the default uicontrol font of the graphics root object:
To access the default uicontrol font, use |
MATLAB measures all units from the lower left corner of the parent object.
If you change the value of the Units
property,
it is good practice to return it to its default value after completing
your computation to avoid affecting other functions that assume the Units
property
is set to the default value.
The order in which you specify the Units and Position properties has these effects:
If you specify the Units
property
before the Position
property, then MATLAB sets Position
using
the units you specified.
If you specify the Units
property
after the Position
property, MATLAB sets
the position using the default Units
. Then, MATLAB converts
the Position
values to the equivalent values
in the units you specified.
SelectionChangedFcn
— Selection changed callback''
(default) | function handle | cell array | character vectorNote
The name of this property changed from
SelectionChangeFcn
to
SelectionChangedFcn
in
R2014b.
Selection changed callback, 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.
For more information about specifying a callback property value as a function handle, cell array, or character vector, see How to Specify Callback Property Values.
This callback function executes when the user selects a different button within the button group.
If you specify this property as a function handle (or cell array containing a function handle), MATLAB passes an object containing callback data as the second argument to the callback function. This object contains the properties described in this table. You can access these properties inside the callback function using dot notation.
Property | Description |
---|---|
OldValue | Previously selected button, or
|
NewValue | Currently selected button |
Source | The parent |
EventName |
|
Define a SelectionChangedFcn
callback to
make your program respond when the user selects different
buttons within the button group. Do not code the response in the
individual component callback functions.
If you want another component to respond to the selection, then
that component's callback function can access the selected radio
button or toggle button from the
SelectedObject
property of the
ButtonGroup
object.
SizeChangedFcn
— Size change callback function''
(default) | function handle | cell array | character vectorSize change callback function, 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.
Define this callback to customize the app layout when the size of this container changes (e.g., when the user resizes the window).
The SizeChangedFcn
callback executes when:
This container becomes visible for the first time.
This container is visible while its size changes.
This container becomes visible for the first time after its size changes. This situation occurs when the size changes while the container is invisible, and then it becomes visible later.
Other important points to consider when defining a SizeChangedFcn
callback:
Consider delaying the display of this container until
after all the variables that the SizeChangedFcn
uses
are defined. This practice can prevent the SizeChangedFcn
callback
from returning an error. To delay the display of the container, set
its Visible
property to 'off'
.
Then, set the Visible
property to 'on'
after
you define the variables that your SizeChangedFcn
callback
uses.
If your app contains nested containers, they resize from the inside out.
To access the container that is resizing from within
the SizeChangedFcn
, refer to the source object
(the first input argument in the callback) or use the gcbo
function.
Tip
As an easy alternative to specifying a SizeChangedFcn
callback,
you can set the Units
property of all the objects
you put inside a container to 'normalized'
. Doing
so makes those components scale proportionally with the container.
See Lay Out a UI Programmatically for more information
about managing layouts with SizeChangedFcn
callbacks.
ButtonDownFcn
— Button-press callback function''
(default) | function handle | cell array | character vectorButton-press callback function, 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.
For more information about specifying a callback property value as a function handle, cell array, or character vector, see How to Specify Callback Property Values.
The ButtonDownFcn
callback is a function that executes when the user
clicks a mouse button within the container.
CreateFcn
— Component creation function''
(default) | function handle | cell array | character vectorComponent creation function, 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.
For more information about specifying a callback property value as a function handle, cell array, or character vector, see How to Specify Callback Property Values.
This property specifies a callback function to execute when MATLAB creates the component. MATLAB initializes all component property values before executing the
CreateFcn
callback. If you do not specify the
CreateFcn
property, then MATLAB executes a default creation function.
Use the gcbo
function in your
CreateFcn
code to get the component object that is being
created.
Setting the CreateFcn
property on an existing component object
has no effect.
DeleteFcn
— Component deletion function''
(default) | function handle | cell array | character vectorComponent deletion function, 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.
For more information about specifying a callback property value as a function handle, cell array, or character vector, see How to Specify Callback Property Values.
The DeleteFcn
property specifies a callback function to execute
when MATLAB deletes the component (for example, when the user closes the window).
MATLAB executes the DeleteFcn
callback before destroying the
properties of the component object. If you do not specify the
DeleteFcn
property, then MATLAB executes a default deletion function.
Use the gcbo
function in your
DeleteFcn
code to get the component object that is being
deleted.
ResizeFcn
— Resize callback function (not recommended)''
(default) | function handle | cell array | character vectorResize callback function, 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.
Note
Use of the ResizeFcn
property is not recommended. It might be
removed in a future release. Use SizeChangedFcn
instead.
Data Types: function_handle
| cell
| char
Interruptible
— Callback interruption'on'
(default) | on/off logical valuesCallback interruption, 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
.
The Interruptible
property determines if a running callback can
be interrupted. There are two callback states to consider:
The running callback is the currently executing callback.
The interrupting callback is a callback that tries to interrupt the running callback.
Whenever MATLAB invokes a callback, that callback attempts to interrupt the running
callback (if one exists). The Interruptible
property of the object
owning the running callback determines if interruption is allowed:
A value of 'on'
allows other callbacks to interrupt the
object's callbacks. The interruption occurs at the next point where
MATLAB processes the queue, such as when there is a drawnow
, figure
, getframe
, waitfor
, or pause
.
If the running callback contains one of these commands, then MATLAB stops the execution of the callback at this point and executes the interrupting callback. MATLAB resumes executing the running callback when the interrupting callback completes.
If the running callback does not contain one of these commands, then MATLAB finishes executing the callback without interruption.
A value of 'off'
blocks all interruption attempts. The
BusyAction
property of the object owning the
interrupting callback determines if the interrupting callback is discarded
or put into a queue.
Note
Callback interruption and execution behave differently in these situations:
If the interrupting callback is a DeleteFcn
, CloseRequestFcn
,
or SizeChangedFcn
callback, then the interruption
occurs regardless of the Interruptible
property
value.
If the running callback is currently executing the waitfor
function,
then the interruption occurs regardless of the Interruptible
property
value.
Timer
objects execute according to
schedule regardless of the Interruptible
property
value.
MATLAB does not save the state of properties
or the display when an interruption occurs. For example, the object
returned by the gca
or gcf
command might change when another
callback executes.
See Interrupt Callback Execution for an example that shows
how the Interruptible
and BusyAction
properties
affect the behavior of a program.
BusyAction
— Callback queuing'queue'
(default) | 'cancel'
Callback queuing specified as 'queue'
(default)
or 'cancel'
. The BusyAction
property
determines how MATLAB handles the execution of interrupting callbacks.
There are two callback states to consider:
The running callback is the currently executing callback.
The interrupting callback is a callback that tries to interrupt the running callback.
The BusyAction
property of the source of
the interrupting callback determines how MATLAB handles its execution.
The BusyAction
property has these values:
'queue'
— Put the interrupting
callback in a queue to be processed after the running callback finishes
execution.
'cancel'
— Do not execute
the interrupting callback.
Whenever MATLAB invokes a callback, that callback always
attempts to interrupt an executing callback. The Interruptible
property
of the object whose callback is running determines if interruption
is allowed. If Interruptible
is set to:
on
— Interruption occurs
at the next point where MATLAB processes the queue. This is the
default.
off
— The BusyAction
property
(of the object owning the interrupting callback) determines if MATLAB enqueues
or ignores the interrupting callback.
See Interrupt Callback Execution for an example that shows
how the BusyAction
and Interruptible
properties
affect the behavior of a program.
BeingDeleted
— Deletion statusThis property is read-only.
Deletion status, returned as an on/off logical value of type matlab.lang.OnOffSwitchState
.
MATLAB sets the BeingDeleted
property to
'on'
when the DeleteFcn
callback begins
execution. The BeingDeleted
property remains set to
'on'
until the component object no longer exists.
Check the value of the BeingDeleted
property to verify that the object is not about to be deleted before querying or modifying it.
HitTest
— Ability to become current object'on'
(default) | on/off logical valueAbility to become current
object, 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'
— Sets the current
object to the ButtonGroup
when
the user clicks the component in the running app.
Both the CurrentObject
property of the Figure
and the
gco
function return the ButtonGroup
as the current object.
'off'
— Sets the current
object to be the closest ancestor of the
ButtonGroup
whose
HitTest
is
'on'
when the user clicks the
component in the running app.
Parent
— Parent objectFigure
| Panel
| ButtonGroup
| Tab
Parent object, specified as a Figure
, Panel
,
ButtonGroup
, or Tab
object. Use this property
to specify the parent container when creating a UI component or to move an existing UI
component to a different parent container.
Children
— ButtonGroup
childrenGraphicsPlaceholder
array (default) | 1-D array of component objectsButtonGroup
children, returned as an empty
GraphicsPlaceholder
or a 1-D array of
component objects. Although a button group manages only the
selection of radio buttons and toggle buttons, its children can
be instances of Axes
,
Panel
, ButtonGroup
,
or any style of UIControl
objects.
You cannot add or remove children using the
Children
property. Use this property to view the list of children or to
reorder the children. The order of the children reflects the front-to-back order (stacking
order) of the components on the screen. MATLAB might not allow you to change the order of certain objects. For example,
UIControl
and Legend
objects are always in front of
Axes
objects.
To add a child to this list, set the Parent
property of the child component to the ButtonGroup
object.
Objects with the HandleVisibility
property
set to 'off'
are not listed in the Children
property.
HandleVisibility
— Visibility of ButtonGroup
handle'on'
(default) | 'callback'
| 'off'
Visibility of ButtonGroup
handle, specified as
'on'
, 'callback'
, or 'off'
.
This property controls the visibility of the ButtonGroup
handle in its parent's list of children. When a handle is not visible
in its parent's list of children, it is not returned by functions that obtain handles by
searching the object hierarchy or querying handle properties. These functions include
get
, findobj
, gca
, gcf
, gco
, newplot
, cla
, clf
, and close
. The
HandleVisibility
property also controls the visibility of the
object’s handle in the parent figure's CurrentObject
property.
Handles are still valid even if they are not visible. If you know an object's handle,
you can set and get its properties, and pass it to any function that operates on
handles.
HandleVisibility Value | Description |
---|---|
'on' | The ButtonGroup handle is
always visible. |
'callback' | The ButtonGroup handle is
visible from within callbacks or functions invoked by callbacks, but
not from within functions invoked from the command line. This option
blocks access to the ButtonGroup
at the command-line, but allows callback functions to access
it. |
'off' | The ButtonGroup handle is
invisible at all times. This option is useful for preventing
unintended changes to the UI by another function. Set the
HandleVisibility to
'off' to temporarily hide the handle during
the execution of that function. |
Set the graphics root ShowHiddenHandles
property to
'on'
to make all handles visible, regardless of their
HandleVisibility
value. This setting has no effect on their
HandleVisibility
values.
Note
Do not try to access radio buttons and toggle buttons that are managed by a
uibuttongroup
outside of the
button group. Set the HandleVisibility
of those radio
buttons and toggle buttons to 'off'
to prevent accidental
access.
Type
— Type of graphics object'uibuttongroup'
This property is read-only.
Type of graphics object, returned as
'uibuttongroup'
.
Tag
— Object identifier''
(default) | character vector | string scalarObject 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.
UserData
— User data[]
(default) | arrayUser data, specified as any array. Specifying UserData
can be
useful for sharing data within apps. See Share Data Among Callbacks for more
information.
UIContextMenu
property is not recommendedNot recommended starting in R2020a
Starting in R2020a, using the UIContextMenu
property to assign a
context menu to a graphics object or UI component is not recommended. Use the
ContextMenu
property instead. The property values are the
same.
There are no plans to remove support for the UIContextMenu
property at this time. However, the UIContextMenu
property no
longer appears in the list returned by calling the get
function on a
graphics object or UI component.