User`s guide

WriteCodeforCallbacks
Note User interface controls include push buttons, sliders, radio buttons,
check boxes, editable text boxes, st atic text boxes, list boxes, and toggle
buttons. They are sometimes referred to as uicontrols.
Follow the links in the preceding table to see ways in which specific callbacks
are use d. To get specific information for a given callback property, check
the properties reference page for your c ompone nt, e.g., Figure Properties,
Uicontrol Properties, Uibuttongroup Properties, or Uitable Properties.
If you u se figure window callbacks, the order in which they execute and
whether they can be interrupted can affect the behavior of your GUI. For more
information, see “Control Callback Execution and Interruption” on page 14-2.
Specify Callbacks in Function Calls
A GUI can have many components and each component’s properties provide a
way of specifying which callback should run in response to a particular event
for that component. The callback that runs when the user clicks a Yes button
is usually not the one that runs for the No button. Each menu item also
performs a different function and needs its own callback.
You attach a callback to a specific component by setting the value of the
component’s
Callback property (described in the previous table) to the
callback as a property/value pair. The property identifies the callback type
and the value identifies a function to perform it. You can do this when you
define the component or later on in other initialization code. Your code can
also change callbacks while the GUI is being used.
Specify a component callback property value as one of the following:
A string that contains one or more MATLAB or toolbox commands to
evaluate
A handle to a function that is within scope when the GUI is running
A cell array containing a string function name or a function handle, plus
optional strings, constants, or variable names for arguments
12-11