Glemi
Glemi

Reputation: 725

prevent unchecking radio button by clicking on it in matlab

I created GUI using GUIDE and placed to radio buttons in one button-group panel. This conveniently takes care of unchecking one radio button whenever the other one is clicked. Now what's freaking me out is I can actually uncheck a checked radio button by clicking on it a second time, leaving BOTH radio buttons unchecked. It works with either of them. The only thing I want is the standard behavior, is that asking so much....?

I'm using Matlab 7.0, unfortunately this is all I've got.

Upvotes: 0

Views: 1028

Answers (1)

demarcmj
demarcmj

Reputation: 1213

I have 7.0 on one of my computers and r2011a on another and this non-standard behavior seems to be something that they fixed somewhere in between. Since MATLAB 7.0 is all you have, here is an easy way to fix it:

At the top of all radio button callbacks add:

if ~get(hObject,'Value')
    set(hObject,'Value',1)
end

That should fix the problem.

Upvotes: 2

Related Questions