I have my own WTL derived listcontrol.
CPopupList : public CWindowImpl<CPopupList, WTL::CListViewCtrl>,
It works fine, except one thing: I want to catch the notification when selection changes. Not in the parent window (like this: How to detect a CListCtrl selection change?) , but in the CPopupList itself, and then do some things.
Actually I want a small hint window next to the currently selected item to appear, as an additional info of the current item. Just like VS does during autocomplete, giving more info about the functions/properties.
Has anyone any tip how to do this?
Thank you very much.
Update:
Tried:
BEGIN_MSG_MAP(CPopupList)
REFLECTED_NOTIFY_CODE_HANDLER(LVN_ITEMCHANGED, OnListItemChanged)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
But OnListItemChanged() is not called.
In the parent the
REFLECT_NOTIFICATIONS()
is added.
Update2 - SOLUTION
I found the problem:
The parent's MSG_HANDLER:
BEGIN_MSG_MAP(CEditorCtrl)
MESSAGE_RANGE_HANDLER(WM_KEYFIRST,WM_KEYLAST,DelegateMessages)
...
MESSAGE_
...
NOTIFY_CODE_HANDLER(LVN_ITEMCHANGED,OnListItemChanged)
CHAIN_MSG_MAP(parentType)
ALT_MSG_MAP(11)
COMMAND_HANDLER(IDC_PRINT_MONOCHROME,BN_CLICKED,OnPrintMonochromeButton)
REFLECT_NOTIFICATIONS()
END_MSG_MAP()
Moving the REFLECT_NOTIFICATIONS() above the ALT_MSG_MAP(11), and finally the OnListItemChanged is called in the control.
Correct:
REFLECT_NOTIFICATIONS()
ALT_MSG_MAP(11)
COMMAND_HANDLER(IDC_PRINT_MONOCHROME,BN_CLICKED,OnPrintMonochromeButton)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…