+ if (wParam == BN_CLICKED)
+ {
+ wxCommandEvent rEvent( wxEVT_COMMAND_RADIOBUTTON_SELECTED
+ ,m_windowId
+ );
+
+ rEvent.SetEventObject(this);
+ ProcessCommand(rEvent);
+ return TRUE;
+ }
+ else
+ return FALSE;
+} // end of wxRadioButton::OS2Command
+
+void wxRadioButton::SetFocus()
+{
+ // when the radio button receives a WM_SETFOCUS message it generates a
+ // BN_CLICKED which is totally unexpected and leads to catastrophic results
+ // if you pop up a dialog from the radio button event handler as, when the
+ // dialog is dismissed, the focus is returned to the radio button which
+ // generates BN_CLICKED which leads to showing another dialog and so on
+ // without end!
+ //
+ // to aviod this, we drop the pseudo BN_CLICKED events generated when the
+ // button gains focus
+ m_bFocusJustSet = TRUE;
+
+ wxControl::SetFocus();