MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Uživatelská příručka Strana 322

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 759
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 321
8 Programming a GUIDE GUI
7 Add the following code to the mswamp control’s active x1_Click callback.
This code programs the ActiveX control to change the circle radius w hen
the user clicks the circle, and updates the label to display the new radius.
hObject.radius = floor(.9*hObject.radius);
hObject.label = ['Radius = ' num2str(hObject.radiu s)];
refresh(handles.figure1);
8 Add the following commands to the end of the opening function,
Mwsamp_OpeningFcn. This code initializes the label w h en you first open
the GUI.
handles.activex1.label = ...
['Radius = ' num2str(handles.ac tivex1.radius)];
Save the code file. Now, when you open the GUI and click the ActiveX control,
the radius of the circle is reduced by 10 percent and the new value of the
radius is displayed. The following figure shows the GUI after clicking the
circle six tim es.
If you click the GUI e nough times, the circle d isappears .
8-54
Zobrazit stránku 321
1 2 ... 317 318 319 320 321 322 323 324 325 326 327 ... 758 759

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

Žádné komentáře