views:

376

answers:

2

My application is c++, and is a combination of MFC and ATL. The part I'm working with here is MFC.

I have a custom list control class in one of my dialogs which inherits from CListCtrl.

I'm trying to add a handler for the LVN_ITEMCHANGED message so I can update the rest of the dialog form, which is dependant on the contents of the list. More specifically, each list item has a checkbox field and I need to detect when that has been changed.

The problem is, my list isn't sending out the message.

ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST_OUTPUT_CMDS, OnLvnItemchangedListOutputCmds)

That's my message map and it works just fine, I've detected other messages like LVN _ ITEMCHANGING, NM_CLICK, and NM _ RELEASEDCAPTURE by simply changing the message.

My guess is therefore that the listctrl custom class is somehow not posting the message properly.

This question can be answered many ways:
1. How can I post the LVN_ITEMCHANGED message from the child list to it's parent (the dialog)?
2. Am I even catching the right message? Most of the ones I've tried have triggered the update too soon (i.e. before the data in the list is updated) When I do this, the dialog refreshes based on the previous state of the list.
3. Is there something else I should be doing that I'm not? I ask this just to make it open ended.

A: 

Try putting a plain CListCtrl on your dialog, and see if you can catch the message from that one. If you can, you know that the problem is one of the overridden functions (maybe you're not forwarding mouse events to CListCtrl or something).

Roel
A: 

I've moved this question to stackoverflow.com/questions/1272398

The answer is posted there.

CodeFusionMobile