User`s guide
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