[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Sending CListCtrl's NM_CLICK to parent

Posted on 1997-08-05
5
Medium Priority
?
1,126 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 100 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month19 days, 12 hours left to enroll

872 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