MATLAB Creating Graphical User Interfaces

(Barry) #1

5 GUIDE Preferences and Options


h = gcf

For a UI created in GUIDE, set the Command-line accessibility option to prevent
users from inadvertently changing the appearance or content of a UI by executing
commands at the command line or from a script or function, 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 UI can be accessed only from within a
callback. The UI cannot be accessed from
the command line or from a script. This is
the default.
Off (GUI never becomes Current
Figure)

The UI can not be accessed from a callback,
the command line, or a script, without the
handle.
On (GUI may become Current Figure
from Command Line)

The UI can be accessed from a callback,
from the command line, and from a 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 MATLAB File


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


  • “Generate Callback Function Prototypes” on page 5- 10

  • “GUI Allows Only One Instance to Run (Singleton)” on page 5- 11

  • “Use System Color Scheme for Background” on page 5- 11


See “Files Generated by GUIDE” on page 2-24 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 code file for most
components. You must then insert code into these templates.
Free download pdf