User`s guide
8 Programming a GUIDE GUI
Mouse Gestures and Menu Callback Behavior. Callback s for leaf me n u
items, such as for to file or to clipboard in the previous example, actuate
when you release the mouse over them. Callbacks for main menus (like Edit)
and non-leaf submenus (like Copy) actuate when you select them by sliding
the mouse pointer into them after they display. Even w hen it has no menu
items, a main menu callback actuates as soon as you select the menu. When a
submenu contains no items, its callback actuates upon releasing the mouse
over it. H ow ever, if a submenu has one or more child menu items, its callback
actuates as soon as you select it. The mouse button does not have to be d ow n
to trigger the callback of a m enu item that has children.
Opening a Dialog Box from a Menu Callback
The Callback callback for the to file menu item could contain code such as
the following to display the standard dialog box for saving files.
[file,path] = uiputfile('animinit. m','Save file name' );
'Save file name'
is the d ialog box title. In the dialog box, the filename field
is set to
animinit.m, and the filter set to MAT LAB code files (*.m). For more
information, see the
uiputfile reference page.
8-60