GUI: OpeningFcn problem
Show older comments
Hey there! I'm encountering a little problem with my GUI.
Goal: 3 panels disabled by default (when I open the GUI figure) and one of them enables when I select one of three radio buttons.
Problem: This works perfectly well when I run my GUI.m code but it shows an error when I try it by opening the GUI.fig.
OpeningFcn:
function GUI_OpeningFcn(hObject, eventdata, handles, varargin)
set(findall(handles.panel1,'-property','enable'),'enable','off');
set(findall(handles.panel2,'-property','enable'),'enable','off');
set(findall(handles.panel3,'-property','enable'),'enable','off');
handles.output = hObject;
guidata(hObject, handles);
SelectionChangeFcn:
function RadioPanel_SelectionChangeFcn(hObject, eventdata, handles)
switch hObject
case handles.radiobutton1
set(findall(handles.panel1, '-property', 'enable'), 'enable', 'off');
set(findall(handles.panel2, '-property', 'enable'), 'enable', 'off');
set(findall(handles.panel3, '-property', 'enable'), 'enable', 'on');
case handles.radiobutton2
set(findall(handles.panel1, '-property', 'enable'), 'enable', 'on');
set(findall(handles.panel2, '-property', 'enable'), 'enable', 'off');
set(findall(handles.panel3, '-property', 'enable'), 'enable', 'off');
case handles.radiobutton3
set(findall(handles.panel1, '-property', 'enable'), 'enable', 'off');
set(findall(handles.panel2, '-property', 'enable'), 'enable', 'on');
set(findall(handles.panel3, '-property', 'enable'), 'enable', 'off');
end
Accepted Answer
More Answers (0)
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!