Creating Graphical User Interfaces |
Callback Properties in GUIDE
If you are using GUIDE, it 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 also 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.
When you save the GUI, GUIDE constructs the name of the callback by appending an underscore (_
) and the name of the callback property to the value of the component's Tag
property. For example, the MATLAB expression for the Callback
property for a push button in the GUI simple_gui
with Tag
property pushbutton1
would be
simple_gui
is the name of the GUI M-file as well as the name of the main function for that GUI. The remaining arguments are input arguments for pushbutton1_Callback
. See Callback Conventions in GUIDE for more information about the input arguments. See The Tag Property for information about this property.
Associating Callbacks with Components | Component and Figure Callbacks |
© 1994-2005 The MathWorks, Inc.