CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1

Hybrid View

  1. #1
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,234

    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..."
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured