|
I have a buttongroup with three radio buttons that I am trying to get to work. I would like the first button to enable an editable text field and a button; the second button to enable another set editable text field and another button; and the third radion button to enable both editable text fields and buttons. I have something similar with a checkbox in a panel. The code I have so far...
function ProTools_SelectionChangeFcn(hObject,eventdata, handles)
switch get(eventdata.NewValue,'Tag') % Get Tag of selected object.
case 'Abs'
ABS = 1;
handles.ABS = ABS;
case 'Fl'
FL = 1;
handles.FL = FL;
case 'FlAbs'
ABS = 1;
FL = 1;
handles.ABS = ABS;
handles.FL = FL;
end
guidata(hObject,handles)
function AbsLoc_Callback(hObject, eventdata, handles)
% hObject handle to AbsLoc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of AbsLoc as text
% str2double(get(hObject,'String')) returns contents of AbsLoc as a double
if handles.ABS==1;
set(handles.AbsLoc, 'Enable', 'on')
ABSPath = get(hObject,'String');
handles.ABSPath = ABSPath;
guidata(hObject,handles)
end
% --- Executes during object creation, after setting all properties.
function AbsLoc_CreateFcn(hObject, eventdata, handles)
% hObject handle to AbsLoc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in AbsBrowse.
function AbsBrowse_Callback(hObject, eventdata, handles)
% hObject handle to AbsBrowse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if handles.ABS==1;
set(handles.AbsBrowse, 'Enable', 'on')
AbsPath = uigetdir(cd);
end
set(handles.AbsLoc,'String',AbsPath)
function FlLoc_Callback(hObject, eventdata, handles)
% hObject handle to FlLoc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: get(hObject,'String') returns contents of FlLoc as text
% str2double(get(hObject,'String')) returns contents of FlLoc as a double
if handles.FL ==1
set(handles.FlLoc, 'Enable', 'on')
FLPath = get(hObject,'String');
handles.FLPath = FLPath;
guidata(hObject,handles);
end
% --- Executes during object creation, after setting all properties.
function FlLoc_CreateFcn(hObject, eventdata, handles)
% hObject handle to FlLoc (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on button press in FlBrowse.
function FlBrowse_Callback(hObject, eventdata, handles)
% hObject handle to FlBrowse (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
if handles.FL ==1;
set(handles.FlBrowse, 'Enable', 'on')
FlPath = uigetdir(cd);
end
set(handles.FlLoc,'String',FlPath)
|