Creating Graphical User Interfaces Previous page   Next Page

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.

Enable

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.

Actions differ somewhat for different components. See the specific component reference pages for more information.

Visible

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.

Selected

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.

SelectedObject

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.

Value

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.


Previous page  General Information About the Component Properties that Affect Callback Execution Next page

© 1994-2005 The MathWorks, Inc.