MATLAB Creating Graphical User Interfaces

(ff) #1

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 UI using the Menu Editor on
page 6-77.


See “Write Callbacks in GUIDE” on page 7-2 for general information about callbacks.


NoteThis option is available only if you first select the Generate FIG-file and MATLAB
file option.


GUI Allows Only One Instance to Run (Singleton)


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



  • Allow MATLAB software to display only one instance of the UI at a time.

  • Allow MATLAB software to display multiple instances of the UI.


If you allow only one instance, the software reuses the existing figure whenever the
command to run your program is executed. If a UI window 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 figure whenever you issue the
command to run the program.


Even if you allow only one instance of a UI to exist, initialization can take place each time
you invoke it from the command line. For example, the code in an OpeningFcn will run
each time a GUIDE program runs unless you take steps to prevent it from doing so.
Adding a flag to the handles structure is one way to control such behavior. You can do
this in the OpeningFcn, which can run initialization code if this flag doesn't yet exist and
skip that code if it does.


NoteThis option is available only if you first select the Generate FIG-file and MATLAB
file option.


Use System Color Scheme for Background


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


GUIDE Options
Free download pdf