MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manuale Utente Pagina 206

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
  • Pagina
    / 330
  • Indice
  • SEGNALIBRI
  • Valutato. / 5. Basato su recensioni clienti
Vedere la pagina 205
8 Programming the GUI
8-34
If you click the GUI enough times, the circle disappears entirely.
Programming a User Interface Control to Update an ActiveX Control
This topic continues the previous example by adding a slider to the GUI and
programming the slider to change the circle radius. This example must also
update the slider if the user clicks on the circle.
1 Add a slider to your layout and then add the following code to the slider1
Callback callback:
handles.activex1.radius = ...
get(hObject,'Value')*handles.default_radius;
handles.activex1.label = ...
['Radius = ' num2str(handles.activex1.radius)];
refresh(handles.figure1);
The first command
- Gets the
Value of the slider, which in this example is a number between 0
and 1, the default values of the slider’s
Min and Max properties.
- Sets
handles.activex1.radius equal to the Value times the default
radius.
2 In the opening function, add the default radius to the handles structure. The
activex1_Click callback uses the default radius to update the slider value
if the user clicks the circle.
Vedere la pagina 205
1 2 ... 201 202 203 204 205 206 207 208 209 210 211 ... 329 330

Commenti su questo manuale

Nessun commento