Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 758
  • Last Modified:

CListCtrl header click event

How do i catch a mouse click event pressing the header
of a CListCtrl ?
I add the event to the code but, when pressing the table's header, there is no callback to the receiving function.
0
eliad
Asked:
eliad
1 Solution
 
imladrisCommented:
I ran into this problem. peterchen provided a solution along the following lines:

a) After adding a message handler, in the message map, you find something like:
ON_NOTIFY_REFLECT(HDN_ITEMCLICK, OnItemclick)

change this to two lines:
 ON_NOTIFY(HDN_ITEMCLICKA, 1, OnItemclick)
 ON_NOTIFY(HDN_ITEMCLICKW, 1, OnItemclick)

b) in OnInitialUpdate(), do
 GetListCtrl().GetHeaderCtrl()->SetDlgCtrlID(1);


To see the full discussion you can check the PAQ at:

http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=mfc&qid=20094826
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now