Advertisement

Problem with MFC

Started by August 04, 2000 02:23 AM
3 comments, last by Qoy 24 years, 5 months ago
I''m adding a feature to my game''s level editor (using MFC), and this included adding a dialog box with some radio buttons on it. There''s a BN_CLICKED handler for each radio button. The problem is very weird: Basically, after OnInitDialog returns, MFC calls the clicked handler for the first radio button on the form, causing the data to get screwed up, because the user didn''t actually click the button and the program for some reason thinks that he did. I''ve tried breaking on the call and looking back over the call stack, but it gets me nowhere because all the functions on the call stack are MFC functions, nothing I wrote. Does anyone have any suggestions as to how to fix this?
OK. I was just messing around trying things out, and I set everything in the dialog box to NOT be a tab stop, and for some reason now it works.. So I''m thinking it had something to do with the control gaining focus for being a tab stop (it was the first tab stop).

But if anyone knows the reason for this, I''d still like to know it.

Thanks!
Advertisement
How were you selecting the check boxes? If you were clicking then you have a problem, if you were tabbing and pressing space (I prefer this) then that is probably why it didn''t work (it never got clicked ). You might want an ONKEYPRESS event or something similar (I haven''t used MFC, so if I am wrong, then ignore me ).


-Chris Bennett ("Insanity" of Dwarfsoft)

Check our site:
http://www.crosswinds.net/~dwarfsoft/
Check out our NPC AI Mailing List :
http://www.egroups.com/group/NPCAI/
made due to popular demand here at GDNet :)
What are you trying to accomplish by trapping the BN_CLICKED message? Are you assigning the radio button control to a variable or class, or are you just using GetDlgItem? If you talk a little more about what you''re trying to accomplish, I can probably help you. It sounds vaguely like you''re going about this the wrong way, but I can''t know without more information.
Many problems with Radio Buttons in MFC''s dialog wizards happen because of incorrect grouping. Try to look further into that, it used to cause me lots of trouble.

This topic is closed to new replies.

Advertisement