Multiple Triggering of OnClicked event of Radio Btn using a
Abhijit Gore -- agore@digit.com
Monday, April 15, 1996
Hi,
Env : VC++ 2.2 , Win 95
I have a dialog box with two radio buttons, with default being Button-1.
whenever the user selects the button-2 , a confirmation message is asked and
depending upon the user response the control either goes to the Button-2 (
if user has selected yes) , else it returns back to Button-1.
----------------------------
| |
| O Button-1 O Button-2 |
| |
----------------------------
The Problem is that the above mentioned functionality does not work properly
with a Keyboard( i.e with arrow keys ). what happens is multiple triggering
of the OnClicked event of the Button-2. What happens is that after the
Confirmation is asked the Focus returns back to the Radio Button that
triggered it ( i.e Button-2 ), causing a infinite loop.
Included below is the Code from my OnClicked event
void CExportDialog::OnClicked()
{
if (::MessageBox(m_pParent," Are you sure you want to do this ? ",
MB_YESNO)== IDNO)
{
// do some processing
mButton2.SetCheck(0);
mButton1.SetCheck(1);
mButton1.SetFocus();
return;
}
// do Some Processing
}
Could U help?
ThanX
--
mmmmm
g( o o )g
+-oOO--(_)---OOo------------------------------------+
| Abhijit Gore |
| DigiTools Int Pvt Ltd |
| SEEPZ,Bombay |
| |
| Internet: agore@digit.com |
| .ooo0 0ooo. Phone : +91-22-838 1006/2645 |
| ( ) ( ) +91-22-832 0230/0285 |
+---\ (---) /---------------------------------------+
\_) (_/
Mario Contestabile -- Mario_Contestabile.UOS__MTL@UOSMTL2.universal.com
Wednesday, April 17, 1996
>with a Keyboard( i.e with arrow keys ). what happens is multiple triggering
>of the OnClicked event of the Button-2. What happens is that after the
>Confirmation is asked the Focus returns back to the Radio Button that
>triggered it ( i.e Button-2 ), causing a infinite loop.
>Included below is the Code from my OnClicked event
>void CExportDialog::OnClicked()
>{
> if (::MessageBox(m_pParent," Are you sure you want to do this ? ",
>MB_YESNO)== IDNO)
> {
> // do some processing
> mButton2.SetCheck(0);
> mButton1.SetCheck(1);
> mButton1.SetFocus();
> return;
> }
> // do Some Processing
>}
You may wish to check CWnd::CheckRadioButton()
mcontest@universal.com
| Вернуться в корень Архива
|