User`s guide

12 Code a Programmatic GUI
KindsofCallbacks
The GUI figure and each type of component has specific kinds of callbacks
with which you can associate it. The callbacks that are available for each
component are defined a s properties of that component. For example, a push
button has five callback properties:
ButtonDownFcn, Callback, CreateFcn,
DeleteFcn,andKeyPressFcn. A panel has four callback properties:
ButtonDownFcn, CreateFcn, Delete Fcn,andResizeFcn. You can, but are
not required to, create a callback function for each of these properties. The
GUI itself, which is a figure, also has certain kinds of callbacks with which
it can be associated.
Each kind of callback has a triggering mechanism or event that causes it to
be called. The following table lists the callback pro pe rties th a t are availab le,
their triggering events, and the components to which they apply.
Callback Property Triggering Event Components
ButtonDownFcn
Executes when the user
presses a mouse button
while the pointer is on
or within five pixels of a
component or figure.
Axes, figure,
button group,
panel, user
interface controls
Callback
Control action. Executes,
for example, when a user
clicks a push button or
selects a menu item.
Context menu,
menu user
interface controls
CellEditCallback
Reports any edit made to
avalueinatablewith
editable cells; uses event
data.
uitable
CellSelectionCallback
Reports indices of cells
selected by mouse gesture
in a table; uses event data.
uitable
12-8