Hello, I am somewhat new to windows programming and was wondering if someone could answer a question I have about some strange behavior. I have a row of check boxes that I am using to check individually, and also one check box called all that will check or uncheck all of the other boxes, according to if it is checked or unchecked itself. Here's what I am doing for normal check boxes.
What this does (or is supposed to do) is if the check is already set, unset it and set the member variable to false, otherwise it must be unchecked so we check it and set to true.
Code:
CButton *btnPtr = (CButton *) GetDlgItem(IDC_CHECK_1);
if (btnPtr->GetCheck()){
m_check1 = false;
btnPtr->SetCheck(0);
}
else{
m_check1 = true;
btnPtr->SetCheck(1);
}
That code is in the single checkboxes, like check1, check2, check3, etc. However, it does not seem to work. When the box is unchecked, it goes to if and if it's checked it goes to the else. Now comes the strange part. In the check all check box I have code that looks like this.
Code:
m_check1_all = true;
CApplicationNameDlg::OnBnClickedCheck1();
CApplicationNameDlg::OnBnClickedCheck2();
CApplicationNameDlg::OnBnClickedCheck3();
When that code executes all the check boxes actually check and behave how I want them to. However when trying to check them individually they seem to function in the opposite manner. Does anyone know what could be the problem? Thank you.