sternocera
asked on
MFC / C++: What message indicates that the selection of a CListCtrl has changed?
Hello,
I have a ClistCtrl in a dialog that displays data that can be changed with/are reflected by various form widgets, mostly CEdits. I'd like to catch any MFC messages sent by the CListCtrl that indicate that the user's focus has changed (i.e that they have clicked on a different row of the ClistCtrl), so that I can update the form widgets as appropriate.
How can this be done?
Regards,
Sternocera
I have a ClistCtrl in a dialog that displays data that can be changed with/are reflected by various form widgets, mostly CEdits. I'd like to catch any MFC messages sent by the CListCtrl that indicate that the user's focus has changed (i.e that they have clicked on a different row of the ClistCtrl), so that I can update the form widgets as appropriate.
How can this be done?
Regards,
Sternocera
ASKER
BEGIN_MESSAGE_MAP(CBatchAd
NOTIFY_HANDLER(IDC_LIST_PR
END_MESSAGE_MAP()
This seems to cause all kinds of errors. I guess I got something wrong. What should I do to handle the message?
Regards,
Sternocera
try this:
NOTIFY_HANDLER(IDC_LIST_PR ODUCTS_ADD ED, LVN_ODSTATECHANGED, OnListSelChanged)
NOTIFY_HANDLER(IDC_LIST_PR
ASKER
Curiously, this causes the following error message:
error C3861: 'NOTIFY_HANDLER': identifier not found
Plus a whole bunch of syntax errors arising from that.
Is this an MFC handler or an ATL handler?
Regards,
Sternocera
error C3861: 'NOTIFY_HANDLER': identifier not found
Plus a whole bunch of syntax errors arising from that.
Is this an MFC handler or an ATL handler?
Regards,
Sternocera
It's an ATL handler.
Try the following:
ON_NOTIFY_REFLECT(LVN_ODST ATECHANGED , OnListSelChanged)
void CBatchAdd::OnListSelChange d( NMHDR *pNMHDR, LRESULT *pResult )
{
LPNMLVODSTATECHANGE pNMLV = reinterpret_cast<LPNMLVODS TATECHANGE >( pNMHDR );
...
}
Try the following:
ON_NOTIFY_REFLECT(LVN_ODST
void CBatchAdd::OnListSelChange
{
LPNMLVODSTATECHANGE pNMLV = reinterpret_cast<LPNMLVODS
...
}
ASKER
alb66,
That will build, but doesn't appear to do anything,
Thanks
That will build, but doesn't appear to do anything,
Thanks
ASKER
Aren't these messages only for windows CE?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This works for me:
ON_NOTIFY( LVN_ITEMCHANGED, IDC_LIST_PRODUCTS_ADDED, &CBatchAdd::OnListSelChang ed)
Thanks,
Sternocera
ON_NOTIFY( LVN_ITEMCHANGED, IDC_LIST_PRODUCTS_ADDED, &CBatchAdd::OnListSelChang
Thanks,
Sternocera
http://msdn2.microsoft.com/en-us/library/aa933044.aspx