-
April 27th, 2009, 05:33 AM
#1
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
Last edited by ovidiucucu; April 27th, 2009 at 09:10 AM.
Reason: Added "See also..."
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|