Creating Graphical User Interfaces |
Editing Version 5 GUIs with Version 7 GUIDE
In MATLAB Version 5, GUIDE saved GUI layouts as MAT-file/M-file pairs. Since MATLAB Version 6, GUIDE saves GUI layouts as FIG-files. GUIDE also generates an M-file to program the GUI callbacks. However, this M-file does not contain layout code as did M-files created in Version 5.
Use the following procedure to edit a Version 5 GUI with Version 7 GUIDE:
HandleVisibility
property is set to off
), set the root ShowHiddenHandles
property to on
:
Children
property:
This statement returns the handles of all figures that exist when you issue the command. For simplicity, ensure that the GUI is the only figure displayed.
guide
command:
Saving the GUI in Version 7 GUIDE
When you save the edited GUI with Version 7 GUIDE, MATLAB creates a FIG-file that contains all the layout information. The original MAT-file/M-file combination is no longer used. To display the revised GUI, run the M-file generated by GUIDE.
Updating Callbacks
Ensure that the Callback
properties of the uicontrols in your GUI are set to the desired callback string or callback M-file name when you save the FIG-file. If your Version 5 GUI used an M-file that contained a combination of layout code and callback routines, then you should restructure the M-file to contain only the commands needed to initialize the GUI and the callback functions. The M-file generated by Version 7 GUIDE can provide a model of how to restructure your code.
Programming the GUI M-file | Creating a GUI |
© 1994-2005 The MathWorks, Inc.