Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MFC "Warning: skipping non-radio button in group."

When running an old MFC application in Visual Studio's debugger I've seen a lot of warnings in the Output window like the following:

Warning: skipping non-radio button in group.

I understand that in MFC you put radio buttons in groups to indicate which sets of radio buttons go together. If I remember correctly you do this by setting the "group" property of the first radio button to true, and then set the rest of the radio buttons "group" property to false.

I have three questions about this warning.

  1. How do you get rid of this warning? Do you have to set the "group" property of all non-radio button controls to true to avoid this, or should you just set it for the first control after the last radio button?

  2. Is there an easy way to figure out what controls or dialogs have this problem? I could open each dialog and fiddle with it until the warning pops up. This application has a lot of dialogs though, so it would be nice if there was an easier way.

  3. What negative behavior can occur if you don't fix this warning? In other words, does this even matter?

like image 449
ryan_s Avatar asked Sep 24 '08 23:09

ryan_s


1 Answers

Between the responses here and some research in old forums I think I've figured out at least how to fix my problems. Here is what I've found out for my above questions.

  1. ChrisN and Smashery suggested that I reorder the tabs to make sure radio buttons are ordered sequentially, and this did fix some of the warnings.

    Additionally, the first control in the tab order after the radio button group must have the WS_GROUP property set (or the group property set to true in the editor). This tells MFC that the radio button group has ended. Without it all remaining controls in the tab order until the next WS_GROUP will generate the warning. After doing both these things the warnings in these dialogs went away.

  2. This is still an open question, I didn't find a good way to locate these problems without opening each dialog and waiting for warnings.

    If you know a dialog is creating this warning but you don't know what control is causing it, you can set a breakpoint in the DDX_Radio() function on the TRACE() call that generates the warning. This can make it easier to identify the specific control that is being complained about.

  3. I agree with ChrisN, I can't think of any reason for this warning other than to make you double check your tab order. Elsewhere online I can't find any other reference to a problem that this might cause.

like image 180
ryan_s Avatar answered Nov 12 '22 21:11

ryan_s