Clear Checkbox??
-
I have two checkboxes. The second becomes enabled when the first is checked and disabled when the first is unchecked, but I also need the second to be unchecked automatically when the first is unchecked by the user. The following code disables the second but doesn't clear it. *********************************************************** void CTab3_SMS::OnSaveToPCcb() { //Get the current values from the screen UpdateData(TRUE); //Is the "FIRST" checkbox checked? if (m_bSaveToPC == TRUE) { //Enable the "SECOND" checkbox GetDlgItem(IDC_DELETEFROMSIMCB)->EnableWindow(TRUE); } else { //No; clear and disable the "SECOND" checkbox GetDlgItem(IDC_DELETEFROMSIMCB)->EnableWindow(FALSE); } } *********************************************************** What other command goes into the else{} statement? Thanks, Aoife
-
I have two checkboxes. The second becomes enabled when the first is checked and disabled when the first is unchecked, but I also need the second to be unchecked automatically when the first is unchecked by the user. The following code disables the second but doesn't clear it. *********************************************************** void CTab3_SMS::OnSaveToPCcb() { //Get the current values from the screen UpdateData(TRUE); //Is the "FIRST" checkbox checked? if (m_bSaveToPC == TRUE) { //Enable the "SECOND" checkbox GetDlgItem(IDC_DELETEFROMSIMCB)->EnableWindow(TRUE); } else { //No; clear and disable the "SECOND" checkbox GetDlgItem(IDC_DELETEFROMSIMCB)->EnableWindow(FALSE); } } *********************************************************** What other command goes into the else{} statement? Thanks, Aoife
CheckDlgButton (IDC_FOO, FALSE);
/ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com
-
CheckDlgButton (IDC_FOO, FALSE);
/ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com
Ravi Bhavnani wrote: CheckDlgButton (IDC_FOO, FALSE); You may want to be wary of doing things like that: while passing in
FALSE
works, because it evaluates to zero, same asBST_UNCHECKED
, it is not really correct to do so. Also, when newer (less experienced) developers see things like they they may be confused into thinking thatTRUE (1)
andFALSE (0)
are not only correct, but are the only values that can be used with that function. That is, of course, an incorrect conclusion, asBST_INDETERMINATE (2)
can be used as well. Peace! -=- James. -
Ravi Bhavnani wrote: CheckDlgButton (IDC_FOO, FALSE); You may want to be wary of doing things like that: while passing in
FALSE
works, because it evaluates to zero, same asBST_UNCHECKED
, it is not really correct to do so. Also, when newer (less experienced) developers see things like they they may be confused into thinking thatTRUE (1)
andFALSE (0)
are not only correct, but are the only values that can be used with that function. That is, of course, an incorrect conclusion, asBST_INDETERMINATE (2)
can be used as well. Peace! -=- James.You're absolutely right. It should be
CheckDlgButton (IDC_FOO, BST_UNCHECKED)
. /ravi "There is always one more bug..." http://www.ravib.com ravib@ravib.com