MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manuale Utente Pagina 309

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 330
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 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();
Vedere la pagina 308
1 2 ... 304 305 306 307 308 309 310 311 312 313 314 ... 329 330

Commenti su questo manuale

Nessun commento