
12 Examples of GUIs Created Programmatically
12-20
Print Menu Item Callback
The hPrintMenuitemCallback function services the Print menu item and the
Print toolbar button . Selecting the menu item or clicking the toolbar button
triggers the execution of this callback function.
function hPrintMenuitemCallback(hObject, eventdata)
% Callback function run when the Print menu item is selected
printdlg(hMainFigure);
end
The hPrintMenuitemCallback function calls the printdlg function. This
function opens the standard dialog box for printing the current figure.
Close Menu Item Callback
The hCloseMenuitemCallback function services the Close menu item. It
executes when the GUI user selects
Close from the File menu.
function hCloseMenuitemCallback(hObject, eventdata)
% Callback function run when the Close menu item is selected
selection = ...
questdlg(['Close ' get(hMainFigure,'Name') '?'],...
['Close ' get(hMainFigure,'Name') '...'],...
'Yes','No','Yes');
Commenti su questo manuale