MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Guide de l'utilisateur Page 468

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 759
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 467
10 Examples of GUIDE GUIs
Save_Callback Code Listing
function Save_C allb ack(hObject, eventd ata, handles)
% Get the Tag of the menu selected
Tag = get(hObject, 'Tag');
% Get the address array
Addresses = handles.Addresses;
% Based on the item selecte d, take the appropr iate action
switch Tag
case 'Save'
% Save to the default addrboo k file
File = handles.LastFile;
save(File,'Addresses')
case 'Save_A s'
% Allow the user to select the file name to save to
[filename, path name ] = uiputfile( ...
{'*.mat';'*.*'}, ...
'Save as');
% If 'Cancel' was selected th en return
if isequal([fil enam e,pathname],[0,0])
return
else
% Construct the full path and save
File = fullfile(pathname,filename );
save(File,'Addresses')
handles.LastFile = File;
guidata(hObject, handles)
end
end
TheCreateNewMenu
The Create New menu clears the Contact Name and Contact Phone #
text fields to facilitate adding a new name and number. After making the new
entries, the user must then save the address book with the Save or Save As
menus. This callback sets the text
String properties to empty strings:
function New_Ca llba ck(hObject, eventda ta, handles)
set(handles.Contact_Name,'String',' ')
set(handles.Contact_Phone,'String', '')
10-94
Vue de la page 467
1 2 ... 463 464 465 466 467 468 469 470 471 472 473 ... 758 759

Commentaires sur ces manuels

Pas de commentaire