Specifications
Programming Callbacks for GUI Components
4-23
- 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.
Note that clicking the ActiveX control causes the slider to change position
corresponding to the new value of the radius. The command
set(handles.slider1, 'Value', ...
hObject.radius/handles.default_radius);
in the activex1_Click callback resets the slider’s Value each time the user
clicks the ActiveX control.
Viewing the Methods for an ActiveX Control
To view the available methods for the ActiveX control, you first need to obtain
the handle to the control. One way to do this is the following:
1 In the GUI M-file, add the command keyboard on a separate line of the
activex1_Click callback. The command keyboard puts MATLAB in debug
mode and pauses at the
activex1_Click callback when you click the
ActiveX control.
2 Run the GUI and click the ActiveX control.
The handle to the control is now set to
hObject. To view the methods for the
control, enter
methodsview(hObject)
at the MATLAB prompt. This displays the available methods in a new window,
as shown in the following figure.