MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Uživatelský manuál Strana 323

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 330
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 322
Icon Editor
12-45
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();
% update color of the selected block
mIconCData(y, x,:) = color;
localUpdateIconPlot();
end
end
Achieving Proper Resize Behavior
The prepareLayout utility function sets the Units properties of all the GUI
components to enable the GUI to resize correctly on multiple platforms. The
Zobrazit stránku 322

Komentáře k této Příručce

Žádné komentáře