Click to See Complete Forum and Search --> : switch between radio button


May 12th, 1999, 04:52 AM
I have to add a warning message when the user switch from one radio button to another. I used the message (BN_CLICKED) the only one I could use to display an AfxMessageBox with the warning message and Yes-No buttons.
If the user click on a radiobutton, click on another, that's good.
But if the user press the arrows to switch, several BN_CLICKED are generated and my function OnRadioButton is called several times in the same time, displaying a succession of Message Boxes.
Does someone already met this problem and have any solution ?

Pascal.

Jason Teagle
May 12th, 1999, 05:07 AM
In your OnRadioButton(), store a static variable which remembers the ID of the last button (or the CWnd * of the last button, whichever you like best). It should default to 0 or NULL. Then, whenever it gets called, check the current button and ONLY display the message if it is different from the last button for which the message was shown (and don't forget to update the static variable with the current one after this check!).

Does this help?

May 12th, 1999, 08:02 AM
No, it doesn't help.
The problem is that several messages runs several times my function (in the same time).
When the message box is display, another function is ran.