MFC ListBox Control: How CCheckListBox notifies "checkbox status changed"?
Q: How CCheckListBox notifies "checkbox status changed"?
A: When the user changes a checkbox status in a CCheckListBox, an undocumented MFC-specific message is sent to parent window: CLBN_CHKCHANGE.
We can handle this message like in the following example:
Code:
// MyDialog.h
class CMyDialog : public CDialog
{
// ...
afx_msg void OnCheckChangeMyList();
};
Code:
// MyDialog.cpp
// ...
ON_CONTROL(CLBN_CHKCHANGE, IDC_MY_LIST, OnCheckChangeMyList)
END_MESSAGE_MAP()
void CMyDialog::OnCheckChangeMyList()
{
// got it!
}
Note: instead of ON_CONTROL, we can directly use ON_CLBN_CHKCHANGE macro.
Code:
// ...
ON_CLBN_CHKCHANGE(IDC_MY_LIST, OnCheckChangeMyList)
// ...
See also