Graphics |
Callback Properties for Graphics Objects
A callback is a function that executes when a specific event occurs on a graphics object. You specify a callback by setting the appropriate property of the object. This section describes the events (specified via properties) for which you can define callbacks. See Function Handle Callbacks for information on how to define callbacks.
Graphics Object Callbacks
All graphics objects have three properties for which you can define callback routines:
ButtonDownFcn
-- Executes when users click the left mouse button while the cursor is over the object or within a 5-pixel border around the object
CreateFcn
-- Executes during object creation after all properties are set
DeleteFcn
-- Executes just before deleting the object
User Interface Object Callbacks
User interface objects (e.g., uicontrol and uimenu) have a Callback
property through which you define the function to execute when users activate these devices (e.g., click a push button or select a menu).
Figure Callbacks
Figures have additional properties that execute callback routines with the appropriate user action. Only the CloseRequestFcn
property has a callback defined by default:
CloseRequestFcn
-- Executes when a request is made to close the figure (by a close
command, by the window manager menu, or by quitting MATLAB)
KeyPressFcn
-- Executes when users press a key while the cursor is within the figure window
ResizeFcn
-- Executes when users resize the figure window
WindowButtonDownFcn
-- Executes when users click a mouse button while the cursor is over the figure background, a disabled uicontrol, or the axes background
WindowButtonMotionFcn
-- Executes when users move the mouse button within the figure window (but not over menus or title bar)
WindowButtonUpFcn
-- Executes when users release the mouse button, after having pressed the mouse button within the figure
Grouping Objects Within Axes -- hgtransform | Function Handle Callbacks |
© 1994-2005 The MathWorks, Inc.