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

  • 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 293
12 Examples of GUIs Created Programmatically
12-16
Here, setting the Parent property of the File menu to hMainFigure makes it
the child of the main figure. This statement creates a menu bar in the figure
and puts the
File menu on it.
For each of the menu items, setting its
Parent property to the handle of the
parent menu,
hFileMenu, causes it to appear on the File menu.
For the main menu and each item on it, the
Label property defines the
strings that appear in the menu.
Setting the
Separator property to on for the Close menu item causes a
separator line to be drawn above this item.
For each of the menu items, the
Callback property specifies the callback that
services that item. In this example, no callback services the
File menu itself.
These callbacks are defined later in the script.
See the Uicontrol Properties reference page for information about properties of
uicontrol objects and their default values.
The Toolbar and Its Tools
These statements define the toolbar and the two buttons it contains.
hToolbar = uitoolbar(... % Toolbar for Open and Print buttons
'Parent',hMainFigure, ...
'HandleVisibility','callback');
hOpenPushtool = uipushtool(... % Open toolbar button
'Parent',hToolbar,...
'TooltipString','Open File',...
'CData',iconRead(fullfile(matlabroot,...
'toolbox\matlab\icons\opendoc.mat')),...
'HandleVisibility','callback', ...
'ClickedCallback', @hOpenMenuitemCallback);
hPrintPushtool = uipushtool(... % Print toolbar button
'Parent',hToolbar,...
'TooltipString','Print Figure',...
'CData',iconRead(fullfile(matlabroot,...
'toolbox\matlab\icons\printdoc.mat')),...
'HandleVisibility','callback', ...
'ClickedCallback', @hPrintMenuitemCallback);
The uitoolbar function creates the toolbar on the main figure.
The
uipushtool function creates the two push buttons on the toolbar.
Zobrazit stránku 293
1 2 ... 289 290 291 292 293 294 295 296 297 298 299 ... 329 330

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

Žádné komentáře