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

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 330
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 317
12 Examples of GUIs Created Programmatically
12-40
Passing Input Arguments to a GUI
Inputs to the GUI are custom property/value pairs. iconEdit allows three such
properties:
IconWidth, IconHeight, and IconFile. 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
% the GUI
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.
mIconWidth = 16; % Use input property 'iconwidth' to initialize
mIconHeight = 16; % Use input property 'iconheight' to initialize
mIconFile = fullfile(matlabroot,'/toolbox/matlab/icons/');
The values of mIconWidth and mIconHeight are interpreted as pixels. The
fullfile function builds a full filename from parts.
Processing the Input Arguments. The processUserInputs helper function processes
the input property/value pairs.
iconEdit calls processUserInputs after the
layout is complete and just before it needs the inputs to initialize the GUI.
% Process the command line input arguments supplied when
% the GUI is invoked
processUserInputs();
Vue de la page 317
1 2 ... 313 314 315 316 317 318 319 320 321 322 323 ... 329 330

Commentaires sur ces manuels

Pas de commentaire