July 20, 2024, 05:53:10 AM


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.


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:
// 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;

switch (uMsg)
case WM_LBUTTONDOWN: // always received

case WM_LBUTTONUP: // not always received
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.