MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manuale Utente Pagina 180

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 330
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 179
8 Programming the GUI
8-8
Associating Callbacks with Components
A GUI can have many components and GUIDE provides a way of specifying
which callback should run in response to a particular event for a particular
component. The callback that runs when the user clicks a
Yes button is not the
one that runs for the
No button. Each menu item usually performs a different
function.
GUIDE uses each component’s callback properties to associate specific
callbacks with that component. This topic tells you how GUIDE can
automatically set the values of callback properties.
Note “Kinds of Callbacks” on page 8-2 provides a list of callback properties
and the components to which each applies.
Setting Callback Properties Automatically
GUIDE initially sets the value of the most commonly used callback properties
for each component to
%automatic. For example, a push button has five
callback properties,
ButtonDownFcn, Callback, CreateFcn, DeleteFcn, and
KeyPressFcn. GUIDE sets only the Callback property, the most commonly
used callback, to
%automatic. You can use the Property Inspector to set the
other callback properties to
%automatic.
When you next save the GUI, GUIDE replaces
%automatic with a MATLAB
expression that is the GUI calling sequence for the callback. Within the calling
sequence, it constructs the callback name, i.e., the subfunction name, from the
component’s
Tag property and the name of the callback property. The following
figure shows an example of a push button’s
Callback and Tag properties in the
GUIDE Property Inspector before the GUI is saved.
Note If you change the string %automatic before saving the GUI, GUIDE
does not automatically add a callback for that component or menu item.
Vedere la pagina 179
1 2 ... 175 176 177 178 179 180 181 182 183 184 185 ... 329 330

Commenti su questo manuale

Nessun commento