MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Specifikace Strana 141

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 216
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 140
Programming Callbacks for GUI Components
4-21
refresh(handles.figure1);
4 Add the following command to the opening function:
handles.activex1.label = ...
['Radius = ' num2str(handles.activex1.radius)];
5 Run the GUI.
Now, each time you click the ActiveX control, the radius of the circle is reduced
by 10 percent and the new value of the radius is displayed, as shown in the
following figure.
G
GUI After Clicking the Circle Six Times
If you click the GUI enough times, the circle disappears entirely.
Adding a Uicontrol to Change an ActiveX Control Property
You can also add other Uicontrols to the GUI to change the properties of an
ActiveX control. For example, you can add a slider that changes the radius of
the circle in the Mwsamp GUI. To do so,
1 Drag a slider into the layout area.
2 Right-click the slider and select M-file Editor.
3 Add the following command to the slider1 callback:
Zobrazit stránku 140
1 2 ... 136 137 138 139 140 141 142 143 144 145 146 ... 215 216

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

Žádné komentáře