Specifications

3 GUIDE Layout Tools
3-24
Menu Callbacks
By default, the Callback text field in the Menu Editor is set to the string
<automatic>. This causes GUIDE to add the empty callback subfunction to the
application M-file when you save or activate the GUI. If you change this string.
GUIDE does not add a subfunction for that menu item.
Functions Generated in the Application M-File
While the Menu Editor generates an empty callback subfunction for every
menu and submenu, you may not need to program the callbacks for top-level
menus. This is because clicking on a top-level menu automatically displays the
submenus.
Consider the example from the previous section, as illustrated in the following
picture:
When a user selects the
to file item under the Edit menu Copy item, only the
to file callback is required to perform the action.
Suppose, however, that only certain objects can be copied to a file. You can use
the
Copy menu’s callback to enable or disable the to file item, depending on
the type of object selected.
See Getting Started Example - Programming the Menu Callbacks for an
example that uses a high-level menu callback to check for the existence of a
graph before enabling the
Print menu item.
Syntax of the Callback Subfunction
The application M-file contains all callbacks for the GUI, including the menu
callbacks. All generated callbacks use the same syntax.