mercredi 18 janvier 2017

Can't check checkbox in MFC

I have added a checkbox:

str.LoadString("FOO");
fooCheck.Create(str, WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_AUTOCHECKBOX, rect, this, FOO_CHECK_ID);
fooCheck.SetCheck(0);

Then in the Message map I have set

ON_BN_CLICKED(FOO_CHECK_ID, OnLoadingDoseCheckClick)

and I have a separate function

void CBeginBagWnd::OnFooCheckClick()
{
bool checked = (fooCheck.GetCheck() == BST_CHECKED);
}

this method works perfectly in one scenario. But in the same class for another scenario this doesn't work. checkbox is in enabled state but I can't click it and the event

ON_BN_CLICKED 

is not triggered. I was wondering what can affect this. Any idea or suggestion would help alot.

Aucun commentaire:

Enregistrer un commentaire