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

  • 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 308
Color Palette
12-31
Just before returning, colorPalette assigns mOutputArgs the function handle
for its
getSelectedColor helper function and then assigns mOutputArgs to
varargout to return the arguments.
% Return user defined output if it is requested
mOutputArgs{1} =@getSelectedColor;
if nargout>0
[varargout{1:nargout}] = mOutputArgs{:};
end
The iconEditor executes the colorPalette’s getSeclectedColor function
whenever it invokes the function that colorPalette returns to it.
function color = getSelectedColor
% function returns the currently selected color in this
% colorPlatte
color = mSelectedColor;
The iconEditor GUI.
The iconEditor function calls colorPalette only once and
specifies its parent to be a panel in the iconEditor.
% Host the ColorPalette in the PaletteContainer and keep the
% function handle for getting its selected color for editing
% icon.
mGetColorFcn = colorPalette('parent', hPaletteContainer);
This call creates the colorPalette as a component of the iconEditor and then
returns a function handle that
iconEditor can call to get the currently selected
color.
The iconEditor’s
localEditColor helper function calls mGetColorFcn, the
function returned by
colorPalette, to execute the colorPalette’s
getSelectedColor function.
function localEditColor
% helper function that changes the color of an icon data
% point to that of the currently selected color in
% colorPalette
if mIsEditingIcon
pt = get(hIconEditAxes,'currentpoint');
x = ceil(pt(1,1));
y = ceil(pt(1,2));
color = mGetColorFcn();
Vue de la page 308
1 2 ... 304 305 306 307 308 309 310 311 312 313 314 ... 329 330

Commentaires sur ces manuels

Pas de commentaire