Creating Graphical User Interfaces Previous page   Next Page

Changing Tag and Callback Properties

This section discusses what you need to keep in mind if you change a component's tag or the value of any of its callback properties. This section covers the following topics:

Changing a Tag

Once GUIDE generates the GUI M-file, if you subsequently change a component's Tag in the Property Inspector, GUIDE can correctly update the following items according to the new Tag, provided that all components have distinct tags:

As an example, you might want to assign the same tag to each of a set of radio buttons if you want the same callback to service all of them. In this case, you must also change the name of the callback functions in their callback property values to be the same.

Changing Callback Properties

You can change the value of a callback property using the Property Inspector. The initial value of a callback property for a push button in an untitled GUI is similar to

where pushbutton1_Callback is the name of the callback function for that push button in the M-file.

Making the Change in the Property Editor.   For example, to change the callback name in a push button's callback property, select the push button in the Layout Editor and then select Property Inspector in the View menu. Scroll down in the Property Inspector until you come to Callback, as shown in the following figure.

Call back property highlighted in the property inspector dialog box

As shown, the callback property points to pushbutton1_Callback in the M-file. If you need to change the callback property to Closebutton_Callback, replace the string pushbutton1_Callback with Closebutton_Callback in the Callback field, as shown in the following figure.

property inspector GUI with call back propety highlighted

Making Sure Your GUI Still Works.   If you change the value of any callback properties manually in the Property Inspector, GUIDE does not update the corresponding callbacks in the M-file, and might not be able to update the callback properties or references to the handles structure. If you change the value of a callback property, you must make sure that


Previous page  Callback Properties Viewing the Object Hierarchy -- The Object Browser Next page

© 1994-2005 The MathWorks, Inc.