August 18, 2019, 03:22:05 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:
Code Select
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.