jli
asked on
Sending CListCtrl's NM_CLICK to parent
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::OnLButtonDow n() 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.
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 ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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::OnLButtonDow n(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(n Flags, point);
}//endof OnLButtonDown
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::OnLButtonDow
{
// TODO: Add your message handler code here and/or call default
point.x = 2;
DefWindowProc( WM_LBUTTONUP, nFlags, MAKELONG( 2, point.y ));
CListCtrl::OnLButtonDown(n
}//endof OnLButtonDown
Why are you calling the base class version of OnLButtonDown() after already having called the DefWindowProc(). Remove call
to CListCtrl::OnLButtonDown() .
to CListCtrl::OnLButtonDown()
ASKER
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::OnLButtonDow n().