Solved

Sending CListCtrl's NM_CLICK to parent

Posted on 1997-08-05
5
1,052 Views
Last Modified: 2013-11-20
I have created a COwnListCtrl class derived from CListCtrl.  I have implemented the behavior of selecting an item even though user did not click the first column in the CListCtrl.  The problem that I am running into is I am not able to send the left mouse button click NM_CLICK from the COwnListCtrl::OnLButtonDown() to the parent when an user clicks in column other than the first column.  The parent of the COwnListCtrl is a property page.  How do I send the NM_CLICK in the WM_NOTIFY to the property page?  In the property page, I have two COwnListCtrl controls each with a different ID.
0
Comment
Question by:jli
  • 2
  • 2
5 Comments
 
LVL 4

Expert Comment

by:mbhakta
ID: 1303131
Why do you want to send NM_CLICK to the parent ? A CDialog based window doesnot know what NM_CLICK is ? Can you explain why you need it ?
0
 

Accepted Solution

by:
zafir earned 50 total points
ID: 1303132
In COwnListCtrl::OnLButtonDown() call
DefWindowProc( WM_LBUTTONDOWN, nFlags, MAKELONG( 2, point.y ));

This will take care of the selection and also send the notification.

0
 

Author Comment

by:jli
ID: 1303133
I did try your suggestion and placed the DefWindowProc() in the OnLButtonDown().  However, I ran into a situation where the       ON_NOTIFY(NM_CLICK, IDC_STUDY_LIST, OnClickStudyList)
 was received in the parent code only after the second left button down on the same item.  Again this left button down click was clicked in column other than the first column.  Below contains the code indicating where I have placed the DefWindowProc().

void COwnListCtrl::OnLButtonDown(UINT nFlags, CPoint point)
{
      // TODO: Add your message handler code here and/or call default
      point.x = 2;
      DefWindowProc( WM_LBUTTONUP, nFlags, MAKELONG( 2, point.y ));

      CListCtrl::OnLButtonDown(nFlags, point);
}//endof OnLButtonDown

0
 

Expert Comment

by:zafir
ID: 1303134
Why are you calling the base class version of OnLButtonDown() after already having called the DefWindowProc(). Remove call
to CListCtrl::OnLButtonDown().
0
 

Author Comment

by:jli
ID: 1303135
Without having the CListCtrl::OnLButtonDown() I don't get  ON_NOTIFY(NM_CLICK, IDC_STUDY_LIST, OnClickStudyList) in the parent, and I don't see any selection in the list control.  When I click the left button down in the first column, both of the things that I mentioned above occurred as well.  The only notification I get in the parent is ON_NOTIFY(LVN_ITEMCHANGED, IDC_STUDY_LIST, OnItemchangedStudyList).  This was the reason why I placed the CListCtrl::OnLButtonDown() in COwnListCtrl::OnLButtonDown().
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now