| MATLAB® | ![]() |
| On this page… |
|---|
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.
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 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).
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 software).
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.
![]() | Controlling Legends | Function Handle Callbacks | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |