GUI Options

The GUI Options Dialog Box

You can use the GUI Options dialog box to configure various behaviors that are specific to the GUI you are creating. These options take effect when you next save the GUI.

Access the dialog box by selecting GUI Options from the Layout Editor Tools menu.

GUI options dialog box

The following sections describe the options in this dialog box:

Resize Behavior

You can control whether users can resize the figure window containing your GUI and how MATLAB® software handles resizing. GUIDE provides three options:

The first two options set figure and component properties appropriately and require no other action. Other (Use ResizeFcn) requires you to write a callback routine that recalculates sizes and positions of the components based on the new figure size.

Command-Line Accessibility

You can restrict access to a GUI figure from the command line or from an M-file by using the GUIDE Command-line accessibility options.

Unless you explicitly specify a figure handle, many commands, such as plot, alter the current figure, i.e., the figure specified by the root CurrentFigure property and returned by the gcf command. The current figure is usually the figure that is most recently created or clicked in. However, a figure can also become the current figure with the statement

figure(h)

or by setting the CurrentFigure property to the figure's handle.

The gcf function returns the handle of the current figure.

h = gcf

For a GUI created in GUIDE, set the Command-line accessibility option to prevent users from inadvertently changing the appearance or content of a GUI by executing commands at the command line or from an M-file, such as plot. The following table briefly describes the four options for Command-line accessibility.

Option

Description

Callback (GUI becomes Current Figure within Callbacks)

The GUI can be accessed only from within a GUI callback. The GUI cannot be accessed from the command line or from an M-script. This is the default.

Off (GUI never becomes Current Figure)

The GUI can not be accessed from a callback, the command line, or an M-script, without the handle.

On (GUI may become Current Figure from Command Line)

The GUI can be accessed from a callback, from the command line, and from an M-script.

Other (Use settings from Property Inspector)

You control accessibility by setting the HandleVisibility and IntegerHandle properties from the Property Inspector.

Generate FIG-File and M-File

Select Generate FIG-file and M-file in the GUI Options dialog box if you want GUIDE to create both the FIG-file and the GUI M-file (this is the default). Once you have selected this option, you can select any of the following items in the frame to configure the M-file:

See GUI Files: An Overview for information about these files.

Generate Callback Function Prototypes

If you select Generate callback function prototypes in the GUI Options dialog, GUIDE adds templates for the most commonly used callbacks to the GUI M-file for most components you add to the GUI. You must then write the code for these callbacks.

GUIDE also adds a callback whenever you edit a callback routine from the Layout Editor's right-click context menu and when you add menus to the GUI using the Menu Editor.

See Callback Syntax and Arguments for general information about callbacks.

GUI Allows Only One Instance to Run (Singleton)

This option allows you to select between two behaviors for the GUI figure:

If you allow only one instance, the software reuses the existing GUI figure whenever the command to run the GUI is issued. If a GUI already exists, the software brings it to the foreground rather than creating a new figure.

If you clear this option, the software creates a new GUI figure whenever you issue the command to run the GUI.

Use System Color Scheme for Background

The default color used for GUI components is system dependent. This option enables you to make the figure background color the same as the default component background color.

If you select Use system color scheme for background (the default), GUIDE changes the figure background color to match the color of the GUI components.

The following figures illustrate the results with and without system color matching.

color matching example

Generate FIG-File Only

The Generate FIG-file only option enables you to open figures and GUIs to perform limited editing. These can be any figures and need not be GUIs. GUIs need not have been generated using GUIDE. This mode provides limited editing capability and may be useful for GUIs generated in MATLAB Versions 5.3 and earlier. See the guide function for more information.

GUIDE selects Generate FIG-file only as the default if you do one of the following:

When you save the figure or GUI with Generate FIG-file only selected, GUIDE saves only the FIG-file. You must update any corresponding M-files as appropriate.

If you want GUIDE to manage the GUI M-file for you, change the selection to Generate FIG-file and M-file before saving the GUI. If there is no corresponding M-file in the same location, GUIDE creates one. If an M-file with the same name as the original figure or GUI exists in the same location, GUIDE overwrites it. To prevent this, save the GUI using Save As from the File menu and select another filename. You must update the new M-file as appropriate.

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS