MFC ListBox Control: How CCheckListBox notifies "checkbox status changed"?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Thread: MFC ListBox Control: How CCheckListBox notifies "checkbox status changed"?

Hybrid View

  1. #1
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,058

    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 10:10 AM. Reason: Added "See also..."
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center