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

  • 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 741
15 Examples of GUIs Created Programmatically
The iconEditor’s loca lEdi tColor helper function calls mGetColorFcn,
the function returned by
colorPalette, to execute the colorPalette’s
getSelectedColor function.
function localE ditC olor
% helper function that chan ges the color of an icon data
% point to that of the currently selected color in
% colorPalet te
if mIsEditingIc on
pt = get(hIconEditAxes,'currentpo int');
x = ceil(pt(1,1));
y = ceil(pt(1,2));
color = mGetColorFcn();
% update color of the selecte d block
mIconCData(y, x,:) = color;
localUpdateIconPlot();
end
end
Achieve Proper Resize Behavior
The prepareLa yout u tility f un ction sets th e Units properties of all the GUI
components to enable the GUI to resize correctly on m ultiple platforms. Code
in the initialization section of iconEditor calls
prepareLayout w ith the handle
of the main figure.
prepareLayout(hMainFigure);
First, p repareLayout uses findall to retrieve the handles of all o bjects
contained in the figure. The list of retrieved handles includes the
colorPalette,whichisembeddedintheiconEditor, and its children. The
figure’s handle is passed to
findall as the input argument topContainer.
function prepar eLay out(topContainer)
...
allObjects = findall(topContainer);
Then, prepareLayout uses strcmpi to determine if the GUI is resizable.
Depending on the outcome, it sets the
Units properties of all the objects to
either
Normalized or Characters.
15-78
Vue de la page 741
1 2 ... 737 738 739 740 741 742 743 744 745 746 747 ... 758 759

Commentaires sur ces manuels

Pas de commentaire