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

  • 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 723
15 Examples of GUIs Created Programmatically
Pass Output to a Caller on Returning
If a host GUI calls the colorPalette function with an output argument, i t
returns a function handle that the host GUI can call to get the currently
selected color.
The host GUI calls
colorPalette only once. The call creates the color palette
in the specified parent and then returns the function handle. The host GUI
can call the returned function at any time before the color p alette is destroyed.
The data definition se ction of the
colorPalette code file creates a cell array
to hold the output:
mOutputArgs = {}; % Variable for storing output when GUI returns
Just before returning, colorPalette assigns the function handle,
mgetSelectedColor, to the cell array mOutputArgs and then assigns
mOutputArgs to varargout to return the arguments.
mOutputArgs{} = @getSelectedColor;
if nargout>0
[varargout{1:nargout}] = mOutputAr gs{:};
end
Share Data Between Two GUIs
The Icon Editor example G UI, described next, embeds the colorPalette GUI to
enable the user to sele ct colors for the ico n cells. T he colorPalette returns a
function handle to the iconEditor. The iconEditor can then call the returned
function at any time to get the selected color. The following two sections
describe how the two GUIs work together.
The colorPalette GUI. The
colorPalette function defines a cell array,
mOutputArgs, to hold its output arguments.
mOutputArgs = {}; % Variable for storing output when GUI returns
15-60
Vue de la page 723
1 2 ... 719 720 721 722 723 724 725 726 727 728 729 ... 758 759

Commentaires sur ces manuels

Pas de commentaire