Why is the edit text box not enabling ?

1 view (last 30 days)
John-John
John-John on 5 Dec 2015
Commented: John-John on 6 Dec 2015
The text box in the red circle should be enabled when the 'bleed-off' box is cheked, but nothing happens. EDIT Tag of the text box: nbo. Tag of the chek box: nboBox
The radiobuttons on the left enable one of the colored boxes and disables the 2 others. Here is the SelectionChangeFcn of the button panel:
function CycleChoice_SelectionChangeFcn(hObject, eventdata, handles)
switch hObject
case handles.VCbutton
set(findall(handles.CC, '-property', 'enable'), 'enable', 'off');
set(findall(handles.GT, '-property', 'enable'), 'enable', 'off');
set(findall(handles.VC, '-property', 'enable'), 'enable', 'on');
set(handles.nbo,'enable','off');
if get(handles.nboBox,'Value') == 1
display('nboBox on')
set(handles.nbo,'enable','on');
else
set(handles.nbo,'enable','off');
end
set(handles.nbo_drum,'enable','off');
if get(handles.drumBox,'Value') == 1
display('drumBox on')
set(handles.nbo_drum,'enable','on');
else
set(handles.nbo_drum,'enable','off');
end
case handles.CCbutton
set(findall(handles.CC, '-property', 'enable'), 'enable', 'on');
set(findall(handles.GT, '-property', 'enable'), 'enable', 'off');
set(findall(handles.VC, '-property', 'enable'), 'enable', 'off');
case handles.GTbutton
set(findall(handles.CC, '-property', 'enable'), 'enable', 'off');
set(findall(handles.GT, '-property', 'enable'), 'enable', 'on');
set(findall(handles.VC, '-property', 'enable'), 'enable', 'off');
end
  4 Comments
Geoff Hayes
Geoff Hayes on 6 Dec 2015
If I copy and paste your code
if get(handles.nboBox,'Value') == 1
display('nboBox on')
set(handles.nbo,'enable','on');
else
set(handles.nbo,'enable','off');
end
into a simplified GUI, then the above works: if my checkbox is checked then the edit text control is enabled.
So - put a breakpoint at the line
if get(handles.nboBox,'Value') == 1
and re-run your code. When the debugger pauses at this line, what happens next? Is the Value property of nboBox indeed 1? If not, then perhaps this means that the checkbox name/tag has gotten mixed up with one of the other two. Check the string value for this edit box with
get(handles.nboBox,'String')
Is it 'bleed-off'?
John-John
John-John on 6 Dec 2015
I found the source of the problem. I put that part of the code inside an if...end in the SelectionChangeFcn of the radiobuttons. Don't ask why, that's what I did. Sorry for wasting your time (again) and thanks a lot for your time!

Sign in to comment.

Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!