MATLAB: Initially Disabled Button Group when using GUI / GUIDE

button groupcheck box;guiguide

Hello all,
I have an easy GUI question that I can't find the answer to – I can't figure out where to specify that a button group is initially disabled instead of enabled.
In my simplified example, I want to have a check-box that has a disabled (greyed-out) button group below it, until the check-box is selected by the user.
I have gone over similar questions in the forum, and I have found that the way to change the status of the button group is:
function MattsCheckBox_Callback(hObject, eventdata, handles)
if get(hObject,'Value')
set(findall(handles.MattsButtonGroup, '-property', 'enable'), 'enable', 'on');
else
set(findall(handles.MattsButtonGroup, '-property', 'enable'), 'enable', 'off');
end
When I click back and forth on the check-box, sure enough my button group enables and disables. However, before I do any clicking of the check box, the button group starts enabled instead of disabled. Where (or how) do I initialize the button group so that it starts disabled and greyed-out?

Best Answer

I figured it out. There isn't any default disablement of the Button Group - it needs to be coded into the disabled position at the beginning of the code under the _OpeningFcn function. Here is the code:
function MattsTestScript_OpeningFcn(hObject, eventdata, handles, varargin) % Default line produced by GUIDE


handles.output = hObject; % Default line produced by GUIDE
guidata(hObject, handles); % Default line produced by GUIDE
set(findall(handles.MattsButtonGroup, '-property', 'enable'), 'enable', 'off'); % HERE IT IS