Creating Graphical User Interfaces Previous page   Next Page

Selecting Components from the Component Palette

The component palette at the left of the Layout Editor contains the components that you can add to your GUI. This section describes these components.

After selecting the components for your GUI and placing them in the layout area, you need to set their properties and program their callbacks. The following sections describe how to do this:

Push Button

Push buttons generate an action when clicked. For example, an OK button might close a dialog box and apply settings. When you click a push button, it appears depressed; when you release the mouse, the button appears raised and its callback executes.

Toggle Button

Toggle buttons generate an action and indicate whether they are turned on or off. When you click a toggle button, it appears depressed, showing that it is on. When you release the mouse button, the toggle button's callback executes. However, unlike a push button, the toggle button remains depressed until you click the toggle button a second time. When you do so, the button returns to the raised state, showing that it is off, and again executes its callback.

Radio Button

Radio buttons are similar to check boxes, but are typically mutually exclusive within a group of related radio buttons. That is, you can select only one button at any given time. To activate a radio button, click the mouse button on the object. The display indicates the state of the button.

Check Box

Check boxes generate an action when checked and indicate their state as checked or not checked. Check boxes are useful when providing the user with a number of independent choices that set a mode, for example, displaying a toolbar or generating callback function prototypes.

Edit Text

Edit text controls are fields that enable users to enter or modify text strings. Use edit text when you want text as input. The String property contains the text entered by the user. The callback executes when you press Enter for a single-line edit text, Ctl+Enter for a multi-line edit text, or the focus moves away.

Static Text

Static text controls display lines of text. Static text is typically used to label other controls, provide directions to the user, or indicate values associated with a slider. Users cannot change static text interactively and there is no way to invoke the callback routine associated with it.

Slider

Sliders accept numeric input within a specific range by enabling the user to move a sliding bar, which is called a slider or thumb. Users move the slider by pressing the mouse button and dragging the slider, by clicking in the trough, or by clicking an arrow. The location of the slider indicates a percentage of the specified range.

List Box

List boxes display a list of items and enable users to select one or more items.

Pop-Up Menu

Pop-up menus open to display a list of choices when users click the arrow.

Axes

Axes enable your GUI to display graphics (e.g., graphs and images). Like all graphics objects, axes have properties that you can set to control many aspects of its behavior and appearance. See Axes Properties in the MATLAB Graphics documentation for more information on axes objects.

Panel

Panels group GUI components. Panels can make a user interface easier to understand by visually grouping related controls. A panel can have a title and various borders.

Panel children can be panels and button groups as well as axes and user interface controls. The position of each component within a panel is interpreted relative to the panel. If you move the panel, its children move with it and maintain their positions on the panel.

Button Group

Button groups are like panels but can be used to manage exclusive selection behavior for radio buttons and toggle buttons.

For radio buttons and toggle buttons that are managed by a button group, you must include the code to control them in the button group's SelectionChangeFcn callback function, not in the individual uicontrol Callback functions. A button group overwrites the Callback properties of radio buttons and toggle buttons that it manages.

ActiveX Component

ActiveX components enable you to display ActiveX controls in your GUI. See Adding an ActiveX Control to a GUI for more information and an example.


Previous page  Starting the Layout Editor Adding Components to the Layout Area Next page

© 1994-2005 The MathWorks, Inc.