listview with control child
I have a listview with a child control that sits on a row.
When I left click on the child control, I want it to send the
notification back to the list view so that it selects the row as though
I had just clicked on a normal listview element. So, I handled the
WM_LBUTTONDOWN message in the child control to repost the message to
its parent (the listview) as below:
LRESULT OnLButtonDown(UINT uMsg,
WPARAM wParam,
LPARAM lParam,
BOOL& /*bHandled*/)
{
POINT pt = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)};
MapWindowPoints(GetParent(), &pt, 1);
LPARAM lp = MAKEWORD(pt.x, pt.y);
return GetParent().SendMessage(uMsg, wParam, lp);
};
But, instead of just selecting that row, the listview treats it as the
x,y coordinate of a selection box that starts in the top-right corner
of the listview and goes to the mouse pointer.
What can I do differently to get the desired behavior?
Thanks,
-PaulH