User`s guide
Callback Sequencing and Interruption
Note For information about what callbacks are and do, see “Write Code for
Callbacks” on page 12-7 in this User’s Guide and also “Callback Properties
for Graphics Objects”.
Order of Callback Execution
As “Kinds of Callbacks” on page 12-8 describes, interacting with figures and
graphic objects can trigger a variety of callbacks. More than one callback can
execute in response to a given user action, such as a button or key press. In
particular, figure window callbacks can respond to some of the same events as
uicontrol, uipanel, and uitable callbacks. In most cases, the callbacks execute
in a well-defined order. Some applications need to attend to the order of
execution in order to respond to user gestures appropriately and consistently,
especially when several callbacks are triggered by the same gesture. The
following list indicates the normal order of execution of callbacks in response
to mouse button presses and movements in figures a nd graphic objects:
1 Figure WindowButtonMotionFcn (mouse button can be up o r down; no
similar callback exists for objects)
2 Figure WindowButtonDownFcn
3 Figure ButtonDownFcn
4 Object Callback (if En able is on for object)
5 Object ButtonDownFcn (if Enabl e is off for object)
6 Figure WindowButtonUpFcn (no similar callbacks exist)
A different set of callbacks exist to respond to keyboard events. Almost all
keyboard callbacks belong to figure windows. The following list indicates
the n ormal order of execution of callbacks in response to keyboard events in
figure windows and graphic objects:
1 WindowKeyPre ssFcn (in fig u r e win do w or an y of its child objects)
2 KeyPressFcn (figure w indow callback )
14-3