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

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 330
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 187
8 Programming the GUI
8-16
% Choose default command line output for mygui
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes mygui wait for user response (see UIRESUME)
% uiwait(handles.mygui);
Input Arguments
The opening function has four input arguments hObject, eventdata, handles,
and
varargin. The first three are the same as described in “Input Arguments”
on page 8-13. the last argument,
varargin, enables you to pass arguments
from the command line to the opening function. The opening function can make
such arguments available to the callbacks by adding them to the
handles
structure.
For more information about
varargin, see the varargin reference page and
Passing Variable Numbers of Arguments in the MATLAB documentation.
All command line arguments are passed to the opening function via
varargin.
If you open the GUI with a property name/property value pair as arguments,
the GUI opens with the property set to the specified value. For example,
my_gui('Position', [71.8 44.9 74.8 19.7]) opens the GUI at the specified
position, since
Position is a valid figure property.
If the input argument is not a valid figure property, you must add code to the
opening function to make use of the argument. For an example, look at the
opening function for the
Modal Question Dialog GUI template, available from
the GUIDE Quick Start dialog box. The added code enables you to open the
modal dialog with the syntax
mygui('String','Do you want to exit?')
which displays the text 'Do you want to exit?' on the GUI. In this case, it is
necessary to add code to the opening function because
'String' is not a valid
figure property.
Initial Template Code
Initially, the input function template contains these lines of code:
Przeglądanie stron 187
1 2 ... 183 184 185 186 187 188 189 190 191 192 193 ... 329 330

Komentarze do niniejszej Instrukcji

Brak uwag