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

  • 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 321
12 Examples of GUIs Created Programmatically
12-44
Character units are defined by characters from the default system font. The
width of a character unit equals the width of the letter
x in the system font. The
height of a character unit is the distance between the baselines of two lines of
text. Note that character units are not square.
Making a GUI Modal
iconEditor is a modal figure. Modal figures remain stacked above all normal
figures and the MATLAB command window. This forces the user to respond
without being able to interact with other windows. iconEditor makes the main
figure modal by setting its
WindowStyle property to modal.
hMainFigure = figure(...
...
'WindowStyle', 'modal',...
See the Figure Properties in the MATLAB documentation for more information
about using the
WindowStyle property.
Sharing Data Between Two GUIs
The iconEditor embeds a GUI, the colorPalette, to enable the user to select
colors for the icon cells. The colorPalette returns the selected color to the
iconEditor via a function handle.
The colorPalette GUI. Like the iconEditor, the colorPalette defines a cell array,
mOutputArgs, to hold its output arguments.
mOutputArgs = {}; % Variable for storing output when GUI returns
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.
Zobrazit stránku 321

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

Žádné komentáře