Creating Graphical User Interfaces Previous page   Next Page

Event Processing During Callback Execution

The following sequence describes how MATLAB processes events while a callback executes:

  1. If MATLAB encounters a drawnow, figure, getframe, pause, or waitfor command in the callback routine, MATLAB suspends execution and begins processing the event queue.
  2. If the event at the top of the queue calls for a figure window redraw, MATLAB performs the redraw and proceeds to the next event in the queue.
  3. If the event at the top of the queue would cause a callback to execute, MATLAB determines whether the object whose callback is suspended is interruptible.
  4. If the callback is interruptible, MATLAB executes the callback associated with the interrupting event. If that callback contains a drawnow, figure, getframe, pause, or waitfor command, MATLAB repeats these steps for the remaining events in the queue.
  5. If the callback is not interruptible, MATLAB checks the BusyAction property of the object that generated the event.
    1. If BusyAction is queue, MATLAB leaves the event in the event queue.
    2. If BusyAction is cancel, MATLAB discards the event.
  6. When all events have been processed (either left in the queue, discarded, or handled as a redraw), MATLAB resumes execution of the interrupted callback routine.

This process continues until the callback completes execution. When MATLAB returns the prompt to the command window, all events have been processed.


Previous page  Controlling Interruptibility Controlling Figure Window Behavior Next page

© 1994-2005 The MathWorks, Inc.