MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Instrukcja Użytkownika Strona 266

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 330
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 265
10 Examples of GUIDE GUIs
10-42
% If the index is less than one then set it equal to the index
% of the last element in the Addresses array
if i < 1
i = length(Addresses);
end
case 'Next'
% Increase the index by one
i = index + 1;
% If the index is greater than the size of the array then
% point to the first item in the Addresses array
if i > length(Addresses)
i = 1;
end
end
% Get the appropriate data for the index in selected
Current_Name = Addresses(i).Name;
Current_Phone = Addresses(i).Phone;
set(handles.Contact_Name,'string',Current_Name)
set(handles.Contact_Phone,'string',Current_Phone)
% Update the index pointer to reflect the new index
handles.Index = i;
guidata(hObject, handles)
Saving Changes to the Address Book from the Menu
When you make changes to an address book, you need to save the current
MAT-file, or save it as a new MAT-file. The
File submenus Save and Save As
enable you to do this. These menus, created with the Menu Editor, use the
same callback,
Save_Callback.
The callback uses the menu
Tag property to identify whether Save or Save As
is the callback object (i.e., the object whose handle is passed in as the first
argument to the callback function). You specify the menu’s
Tag property with
the Menu Editor.
Saving the Addresses Structure
The handles structure contains the Addresses structure, which you must save
(
handles.Addresses) as well as the name of the currently loaded MAT-file
(
handles.LastFile). When the user makes changes to the name or number,
Przeglądanie stron 265
1 2 ... 261 262 263 264 265 266 267 268 269 270 271 ... 329 330

Komentarze do niniejszej Instrukcji

Brak uwag