MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manuel d'utilisateur Page 250

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 500
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 249
9 Examples of GUIDE UIs
9-4
The code file, closedlg.m, opens in the Editor.
On the Editor tab, in the Navigate section, click Go To, and then select
close_pushbutton_Callback.
The following generated code for the Close button callback appears in the Editor:
% --- Executes on button press in close_pushbutton.
function close_pushbutton_Callback(hObject, eventdata, handles)
% hObject handle to close_pushbutton (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
9
After the preceding comments, add the following:
% Get the current position from the handles structure
% to pass to the modal dialog.
pos_size = get(handles.figure1,'Position');
% Call modaldlg with the argument 'Position'.
user_response = modaldlg('Title','Confirm Close');
switch user_response
case {'No'}
% take no action
case 'Yes'
% Prepare to close application window
% .
% .
% .
delete(handles.figure1)
end
10
Save closedlg.m.
Run the Program
1
On the Layout Editor toolbar, click the Run button .
2
In the closedlg dialog box, click the Close push button.
The modal dialog box opens.
Vue de la page 249
1 2 ... 245 246 247 248 249 250 251 252 253 254 255 ... 499 500

Commentaires sur ces manuels

Pas de commentaire