PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Elias Montoya on February 09, 2012, 08:35:37 PM

Title: Question about listviews and %WM_LBUTTONUP
Post by: Elias Montoya on February 09, 2012, 08:35:37 PM

I cant get the %WM_LBUTTONUP event for single clicks in a listview, but i get them fine with double clicks. Like this:

Click [nothing]

Click [nothing] Click [%WM_LBUTTONUP]

How come?
Title: Re: Question about listviews and %WM_LBUTTONUP
Post by: Paul Squires on February 09, 2012, 10:28:49 PM
do a search in the form for nm_click. That is  better choice for handling listview clicks.
Title: Re: Question about listviews and %WM_LBUTTONUP
Post by: Rolf Brandt on February 10, 2012, 03:01:03 AM
Hello Elias,

I usually handle listview mouse events in the forms Custom Event (See code example). That works ok. There might of course be better solutions.


Function FRMRECCURRENT_CUSTOM ( _
                              hWndForm      As Dword, _  ' handle of Form
                              wMsg          As Long,  _  ' type of message
                              wParam        As Dword, _  ' first message parameter
                              lParam        As Long   _  ' second message parameter
                              ) As Long

   Local lpNmh  As NMHDR Ptr
   Local lpLvNm As NM_LISTVIEW Ptr
   
   Local lLvItem        As Long
   Local lLvSubItem    As Long

   Select Case wMsg
      Case %WM_NOTIFY
         lpNmh = lParam
         If @lpNmh.idFrom = IDC_FRMRECCURRENT_LISTVIEW1 Then
            lpLvNm = lParam
            Select Case @LpLvNm.hdr.Code
               Case %NM_DBLCLK   'left double-click
               Case  %NM_CLICK             
               Case %NM_RCLICK
               Case Else
            End Select
         End If
      Case Else
   End Select

End Function


Rolf
Title: Re: Question about listviews and %WM_LBUTTONUP
Post by: Elias Montoya on February 10, 2012, 03:05:43 AM

Thanks guys.  Perfect. :)
Title: Re: Question about listviews and %WM_LBUTTONUP
Post by: Rolf Brandt on February 10, 2012, 03:22:13 AM
You are up late, Elias...