User`s guide
GUI with Axes, Menu, and Toolbar
• For a push button, the String property defines the label on the button.
Here it is defined as the string
Update.
• Setting the
Callback property to @hUpdateButtonCallback defines the
name of the callback function that services the push button. That is,
clicking the push button triggers the execution of the named callback. This
callback function is defined later in the script.
See the Uicontrol Properties reference page for information about properties
of
uicontrol objects and their default values.
TheFileMenuandItsMenuItems
These statements define the File menu and the three items it contains.
hFileMenu = uimenu(... % File menu
'Parent',hMainFigure,...
'HandleVisibility','callback', ...
'Label','File');
hOpenMenuitem = uimenu(... % Open menu item
'Parent',hFileMenu,...
'Label','Open',...
'HandleVisibility','callback', ...
'Callback', @h Open MenuitemCallback);
hPrintMenuitem = uimenu(... % Print menu item
'Parent',hFileMenu,...
'Label','Print',...
'HandleVisibility','callback', ...
'Callback', @h Prin tMenuitemCallback);
hCloseMenuitem = uimenu(... % Close menu item
'Parent',hFileMenu,...
'Label','Close',...
'Separator','on',...
'HandleVisibility','callback', ...
'Callback', @h Clos eMenuitemCallback);
• The uimenu function creates both the main menu, File,andtheitemsit
contains. For the main menu and each of its items, set the
Parent property
to the handle of the desired parent to create the menu hierarchy you want.
Here, setting the
Parent property of the File menu to hMainFi gure makes
15-11