[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

MFC / C++: What message indicates that the selection of a CListCtrl has changed?

Posted on 2007-11-16
10
Medium Priority
?
1,062 Views
Last Modified: 2013-12-14
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
0
Comment
Question by:sternocera
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
10 Comments
 
LVL 19

Expert Comment

by:alb66
ID: 20297806
0
 

Author Comment

by:sternocera
ID: 20297925

BEGIN_MESSAGE_MAP(CBatchAdd, CDialog)
NOTIFY_HANDLER(IDC_LIST_PRODUCTS_ADDED, LVN_ODSTATECHANGED,&CBatchAdd:: OnListSelChanged)
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
0
 
LVL 19

Expert Comment

by:alb66
ID: 20297968
try this:

NOTIFY_HANDLER(IDC_LIST_PRODUCTS_ADDED, LVN_ODSTATECHANGED, OnListSelChanged)
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:sternocera
ID: 20297987
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
0
 
LVL 19

Expert Comment

by:alb66
ID: 20298046
It's an ATL handler.

Try the following:

ON_NOTIFY_REFLECT(LVN_ODSTATECHANGED, OnListSelChanged)

void CBatchAdd::OnListSelChanged( NMHDR *pNMHDR, LRESULT *pResult )
{
      LPNMLVODSTATECHANGE pNMLV = reinterpret_cast<LPNMLVODSTATECHANGE>( pNMHDR );
      ...
}
0
 

Author Comment

by:sternocera
ID: 20298069
alb66,

That will build, but doesn't appear to do anything,

Thanks
0
 
LVL 19

Expert Comment

by:alb66
ID: 20298141
0
 

Author Comment

by:sternocera
ID: 20298171
Aren't these messages only for windows CE?
0
 
LVL 19

Accepted Solution

by:
alb66 earned 1500 total points
ID: 20298239
No, they are also present in Windows since Windows95

http://msdn2.microsoft.com/en-us/library/bb774845.aspx
0
 

Author Comment

by:sternocera
ID: 20298328
This works for me:

ON_NOTIFY( LVN_ITEMCHANGED, IDC_LIST_PRODUCTS_ADDED, &CBatchAdd::OnListSelChanged)


Thanks,
Sternocera
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question