dialog box constantly reappearing
-
Hi there, I have a group of three checkboxes. When I click on CheckBox2, a dialog box appears asking for user input. What it's suppose to do is when a user cancels a selection it should default to the first checkbox by making a call to CheckRadioButton. It does default but once the user clicks away from the application, the dialog box reappears as if the function to open up the dialog box is called once again. I isolated the problem and found that its the CheckRadioButton() that causes it. I don't know how or why but its the main source of the problem. How can I correct this? Please see my code below. Thanks. void CCheckBox::OnCheckBox2 { CMyDialog dlg; int nRet = -1; nRet = dlg.DoModal(); // Handle the return value from DoModal switch ( nRet ) { case -1: AfxMessageBox("Dialog box could not be created!"); break; case IDOK: { ..code... break; } case IDABORT: { OnCheckBox1(); break; } case IDCANCEL: { OnCheckBox1(); break; } default: break; }; } void CCheckBox::OnCheckBox1() { CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO1); }
-
Hi there, I have a group of three checkboxes. When I click on CheckBox2, a dialog box appears asking for user input. What it's suppose to do is when a user cancels a selection it should default to the first checkbox by making a call to CheckRadioButton. It does default but once the user clicks away from the application, the dialog box reappears as if the function to open up the dialog box is called once again. I isolated the problem and found that its the CheckRadioButton() that causes it. I don't know how or why but its the main source of the problem. How can I correct this? Please see my code below. Thanks. void CCheckBox::OnCheckBox2 { CMyDialog dlg; int nRet = -1; nRet = dlg.DoModal(); // Handle the return value from DoModal switch ( nRet ) { case -1: AfxMessageBox("Dialog box could not be created!"); break; case IDOK: { ..code... break; } case IDABORT: { OnCheckBox1(); break; } case IDCANCEL: { OnCheckBox1(); break; } default: break; }; } void CCheckBox::OnCheckBox1() { CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO1); }
-
Hi there, I have a group of three checkboxes. When I click on CheckBox2, a dialog box appears asking for user input. What it's suppose to do is when a user cancels a selection it should default to the first checkbox by making a call to CheckRadioButton. It does default but once the user clicks away from the application, the dialog box reappears as if the function to open up the dialog box is called once again. I isolated the problem and found that its the CheckRadioButton() that causes it. I don't know how or why but its the main source of the problem. How can I correct this? Please see my code below. Thanks. void CCheckBox::OnCheckBox2 { CMyDialog dlg; int nRet = -1; nRet = dlg.DoModal(); // Handle the return value from DoModal switch ( nRet ) { case -1: AfxMessageBox("Dialog box could not be created!"); break; case IDOK: { ..code... break; } case IDABORT: { OnCheckBox1(); break; } case IDCANCEL: { OnCheckBox1(); break; } default: break; }; } void CCheckBox::OnCheckBox1() { CheckRadioButton(IDC_RADIO1, IDC_RADIO3, IDC_RADIO1); }
-
But how is it recursive on the dialog box when all I am doing is checking the first check box? I can see it being recursive in that everytime I call CheckRadioButton() to check the first button it calls OnCheckBox1() again. I still don't understand why it would recursively call the dialog box as well. Help please. Thanks!
-
Are you calling UpdateData in the right place\correctly? Sounds like the associated member variable is not being kept up-to date as you are expecting. You may already know this, but its a possiblilty all the same!! X|
I inserted UpdateData() at the beginning of both OnCheckBox1() and OnCheckBox2() and UpdateData(FALSE) at the end of each but it still doesn't work. It just doesn't like CheckRadioButton(button1, button2, button3) in OnCheckBox1(). That's what causes it to be recursive. Any ideas? Thanks.