MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Podręcznik Użytkownika Strona 736

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 759
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 735
15 Examples of GUIs Created Programmatically
When the user clicks the Cancel button, its callback,
hOCancelButtonCallback, effectively deletes the icon data then
calls
uiresume. Thisenablesthecodefiletoresumeexecutionwhereit
stopped but it returns a null matrix.
function hCance lBut tonCallback(hObject, eventdata)
% Callback called when the Cancel button i s pressed
mIconCData =[];
uiresume;
delete(hMainFigure);
end
Pass Input Arguments to a GUI
Inputs to the GUI are custom property/value pairs. iconEdit allows three
such properties:
IconWidth, IconHeight,andIconFile. The names are
caseinsensitive.
Definition and Initialization of the Properties. The
iconEdit first defines
a variable
mInputArgs as varargin to accept the user input arguments.
mInputArgs = varargin; % Command line arguments when invoking
%theGUI
The iconEdit function then defines the valid custom properties in a 3-by-3
cell array.
mPropertyDefs = {... % Supported custom property/value
% pairs of this GUI
'iconwidth', @localValidateInput, 'mIconWidth';
'iconheight', @localValidateInput, 'mIconHeight';
'iconfile', @localValidateInput, 'mIconFile'};
The first column contains the property name.
The second column contains a function handle for the function,
localValidateInput, that validates the input property values .
The third column is the local variable that holds the value of the property.
iconEdit then initializes the properties with default values.
15-72
Przeglądanie stron 735
1 2 ... 731 732 733 734 735 736 737 738 739 740 741 ... 758 759

Komentarze do niniejszej Instrukcji

Brak uwag