Creating Graphical User Interfaces Previous page   Next Page

Callback Properties

A callback is a function that executes when a user performs a specific action such as clicking a push button or pressing a keyboard key, or when a component is created or deleted. Each component and menu item has properties that specify its callbacks. When you create a GUI, you must program the callbacks you need to control operation of the GUI.

The following table lists the various callback properties and briefly describes the purpose of each callback. See the components' property reference pages to find out which callbacks apply to a specific component.

Callback Property
Description
ButtonDownFcn
Executes when the user presses a mouse button while the pointer is on or within five pixels of a component.
Callback
Performs the primary work of the component. It executes, for example, when a user clicks a push button or selects a menu item. See The Tag Property for additional information.
CreateFcn
Initializes the component when it is created. It executes when the component is created, but before it becomes visible.
DeleteFcn
Performs cleanup operations just before the component is destroyed.
KeyPressFcn
Executes when the user presses a keyboard key and the callback's component has focus.
ResizeFcn
Executes when a user resizes a panel or button group whose Resize behavior is set to Other.
SelectionChangeFcn
Executes when a user selects a different radio button or toggle button in a button group component.

Adding Callbacks to the M-file

If you checked Generate callback function prototypes in the GUI Options dialog, GUIDE automatically adds the most commonly used callbacks to the GUI M-file. If you want GUIDE to include other callbacks in the GUI M-file and provide names for them, you can do one of the following:


Previous page  Setting Properties for Some Specific Components Changing Tag and Callback Properties Next page

© 1994-2005 The MathWorks, Inc.