MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Guida Utente Pagina 476

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 759
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 475
10 Examples of GUIDE GUIs
8 Click the Show functions icon on the toolbar of the editor and select
close_pushbutton_Callback from the drop-down menu.
The following generated code for the Close button callback appears in
the editor:
% --- Executes o
n button press in close_pushbutton.
function clos
e_pushbutton_Callback(hObject, eventdata, handles)
% hObject hand
le to close_pushbutton (see GCBO)
% eventdata re
served - to be defined in a future v ersion of MATLAB
% handles str
ucture with handles and user data (see GUIDATA)
9 After the preceding comments, add the following code:
% Get the cur
rent position of the GUI from the handles structure
% to pass to t
he modal dialog.
pos_size =
get(handles.figure1,'Position');
% Call moda
ldlg with the argument 'Position'.
user_resp
onse = modaldlg('Title','Confirm Close');
switch us
er_response
case {'No
'}
% take no a
ction
case 'Yes
'
% Prepar
e to close GUI application window
%.
%.
%.
delete
(handles.figure1)
end
Run the Close-Confirmation GUI
RuntheGUIwiththeClose button by clicking the Run button on the Layout
Editor toolbar. The GUI looks like the following figure.
10-102
Vedere la pagina 475
1 2 ... 471 472 473 474 475 476 477 478 479 480 481 ... 758 759

Commenti su questo manuale

Nessun commento