April 19, 2024, 01:17:46 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Missing WM_LBUTTONUP in subclassed listview

Started by sapero, November 14, 2009, 03:20:11 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

sapero

November 14, 2009, 03:20:11 PM Last Edit: February 09, 2010, 01:32:46 PM by sapero
Hello, I have a problem with subclassed listview. I want to implement a grid with custom drawn items and a dropdown button, reusing the list view control.
The list is filled with about 32 items, 10 subitems each row.
When I click an item, WM_LBUTTONUP is not comming, but if I click outside any item, WM_LBUTTONUP comes always. Any idea?
I think list view is entering a message loop to detect doubleclick, after receiving WM_LBUTTONDOWN. Returning zero in WM_LBUTTONDOWN solves this problem, but I need to change selection manually.

This is my code:
CEditFileTypes::OnInitDialog()
{
// init m_hwndProperties, insert items...
SetProp(m_hwndProperties, "CEditFileTypes", this);
m_PropListWndProc = SetWindowLong(m_hwndProperties, GWL_WNDPROC, &MyPropListWndProc);
}

sub MyPropListWndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam),LRESULT
{
CEditFileTypes *edit = GetProp(hwnd, "CEditFileTypes");
RECT rc;
POINT pt;
LVHITTESTINFO hti;

switch (uMsg)
{
case WM_LBUTTONDOWN: // always received

case WM_LBUTTONUP: // not always received
MessageBeep(0);
case WM_DESTROY:
SetWindowLong(hwnd, GWL_WNDPROC, edit->m_PropListWndProc);
RemoveProp(hwnd, "CEditFileTypes");
}
return CallWindowProc(edit->m_PropListWndProc, hwnd, uMsg, wParam, lParam);
}


EDIT: I need to return 0 in WM_LBUTTONDOWN part.