vendredi 27 septembre 2019

Linking 2 check boxes on different page on MFC dialog based application

I have made 1 single dialog with 2 different GUIs and they can be selected by tabs. Each GUI has many check boxes. Some of the check boxes are linked, such that when 1 is checked, the other one will automatically be checked. When the 2 linked check boxes are on the same GUI, I can do it. But when they are on different GUIs, I have problems. Is it possible to link 2 check boxes on different GUIs?

This is how I linked 2 check boxes on the same GUI. When checkbox1 is checked, checkbox2 will also become checked.

void ProjectName::OnBnClickedCheckBox1()
{
    bool x = ((CButton*)GetDlgItem(IDC_CheckBox1))->GetCheck();
    ((CButton *)GetDlgItem(IDC_CheckBox2))->SetCheck(x);
}

But this doesn't work when the other checkbox is on the other GUI. Is there a way I can call a checkbox (eg. IDC_CheckBox3) which is on another GUI on this GUI's .cpp? Or is there any other way I can do this?

Thank you in advance!




Aucun commentaire:

Enregistrer un commentaire