User`s guide
12 Code a Programmatic GUI
close(gcbf)
gcbf
returns the handle of the figure containing the object whose callback
is executing.
Radio Button
You can determine the current state of a radio button from within its
Callback callback by querying the state of its Va lue property, as illustrated
in the following example:
function radiob utto n_Callback(hObject,even tdata)
if (get(hObj ect, 'Value') == get(hOb ject,'Max'))
% Radio button is selected-take appropriate action
else
% Radio button is not selecte d-take appropriate action
end
Radio buttons set Value to Max w h en they are on (when selected) and Min
when off (not selected). hObject is the handle of the component for which the
event was triggered.
You can also change the state of a radio button programmatically by setting
the radio button
Value property to the value of the Max or Min property. For
example,
set(rbh,'Value','Max')
puts the radio button with handle rbh in the selected state.
Note You can use a button group to m anage exclusive selection behavior for
radio buttons. See “Button Group” on page 12-28 for more information.
Slider
You can determine the current value of a slider from within its Callback
callback by querying its Value property, as i llustrated in the follow ing
example:
function slider 1_Ca llback(hObject,eventdat a)
12-26