Creating Graphical User Interfaces |
Information About Component State
At any given time, a callback may need to assess or set its own state or that of another component in the GUI. The Enable
, Visible
, Selected
, SelectedObject
, and Value
properties define the most commonly used states.
See the component reference pages for information about other properties that may be specific to a component.
The Enable
property controls how components respond to left and right mouse button clicks. It also affects which callback routines execute. It applies to all uicontrols, menus, push tools, and toggle tools.
on
- The component is operational (the default). If a user clicks on a uicontrol for which Enable
is set to on
, ButtonDownFcn
and WindowButtonDownFcn
callbacks do not execute.
inactive
- The component is not operational, but looks the same as when Enable
is on
. This is not an option for some components.
If a user clicks on a uicontrol for which Enable
is set to inactive
, MATLAB first executes the WindownButtonDownFcn
of the figure (if defined) and then the ButtonDownFcn
of the uicontrol targeted by the mouse click.
off
- The component is not operational and its String
or image (set by the CData
property) is grayed out.
Actions differ somewhat for different components. See the specific component reference pages for more information.
By default, all components are visible. If you set the value of the Visible
property to off
, the component is not visible, but still exists and you can query and set its properties. If you make a container not visible, its children are also not visible, although their Visible
properties are unchanged.
Setting Visible
to off
for components that are not displayed initially in the GUI, can result in faster startup time for the GUI.
You can query this property to determine if a component is selected. When the Selected
property is on
, MATLAB displays selection handles if the SelectionHighlight
property is also on
.
You can, for example, define the ButtonDownFcn
to set this property, allowing users to select the object with the mouse.
Use this property to determine the currently selected radio button or toggle button in a button group. You can also use it to initialize selection of one of the radio buttons or toggle buttons. By default, SelectedObject
is set to the first radio button or toggle button that is added to the button group. Set it to []
if you want no selection. Note that the SelectionChangeFcn
callback does not execute when this property is set using the set
command.
A property of uicontrol components, this property represents the value of a specific component. For a slider, it is the number indicated on the slider bar. For a list box it is the index of the selected entry. See the Uicontrol Properties reference page for specific information for each style of uicontrol.
General Information About the Component | Properties that Affect Callback Execution |
© 1994-2005 The MathWorks, Inc.