PBVList messages

Started by Marc van Cauwenberghe, August 08, 2010, 06:57:04 AM

Previous topic - Next topic

Marc van Cauwenberghe

Hello,

Can anyone tell me where I have to catch the messages from a PBVList. Messages such as RETURN,...
Is it in the CUSTOM of the form itself. If yes how?

Thanks,
Marc

David Kenny

This works, but it's in FF2 because I didn't see the custom control in FF3.  I'm am assuming that you added it to FF3 (I didn't bother to) or are using FF2.  You will notice that its in the custom message handler for the control itself.

Function FORM1_PBVLIST1_CUSTOM ( _
                               ControlIndex  As Long,  _  ' index in Control Array
                               hWndForm      As Dword, _  ' handle of Form
                               hWndControl   As Dword, _  ' handle of Control
                               wMsg          As Long,  _  ' type of message
                               wParam        As Dword, _  ' first message parameter
                               lParam        As Long   _  ' second message parameter
                               ) As Long
Select Case wMsg
Case %WM_KEYUP
If wParam = %VK_Return  Then MsgBox "Return"

End Select

End Function


David

Marc van Cauwenberghe

Thank you David.
The custom control is not there anymore in FF3. This makes it a little more difficult.
There is no custom message handler for the control. Have to think of something else.

Thanks anyway.

Regards,
Marc

Rolf Brandt

Marc,

if you copy the PBVList control from FF2 to FF3 then you have it again in the FF_Toolbox and you get the Custom Message handler.
Rolf Brandt
http://www.rbsoft.eu
http://www.taxifreeware.com
I cook with wine, sometimes I even add it to the food.
(W. C. Fields)

David Kenny

Rolf is spot-on.  It was as easy as copying the files into the right folder and starting FF3.  The control shows up in the Custom Control list in the FF Workspace "Automagically".  The custom message handler is then available when you have the control selected in the left dropdown on the parent-form's code page.

David

Marc van Cauwenberghe

That is very interesting!!! I will give it a try.

For this application though I would like to create an PBVList on the fly. I need it in every form, so when
using the custom control I will have to add it to every form and I realy do not want to do this. Also I will make some
adjustments to the way PBVList behaves.
Is should be possible. Paul.......

Regards,
Marc


Paul Squires

There are a couple of examples that comes with Borje's code for PBVlist. In the code below, I simply ported some of his example code to be FF compatible. Catching the RETURN key is very easy because it is received through the Form via the WM_COMMAND notification.


Global A()     As String   ' Arrays must be global
Global hVList1 As Dword

%IDC_VLIST1 = 121

'--------------------------------------------------------------------------------
Function FORM1_WM_CREATE ( _
                         hWndForm As Dword, _      ' handle of Form
                         ByVal UserData As Long _  ' optional user defined Long value
                         ) As Long

  Local i As Long
   
  hVList1 = CreateVirtualList(hWndForm, %IDC_VLIST1, 4, 14, 120, 107, %FALSE)

  ' Create array
  ReDim A(65534) As String
  For I = 0 To UBound(A) : A(I) = "Line number " & Format$(I) : Next

  ' Show array
  SendMessage hVList1, %VLB_SETARRAY, VarPtr(A(0)), UBound(A)
  SendMessage hVList1, %VLB_REFRESH, 0, 0
  SetFocus hVList1

End Function


'--------------------------------------------------------------------------------
Function FORM1_WM_COMMAND ( _
                          hWndForm     As Dword, _  ' handle of Form
                          hWndControl  As Dword, _  ' handle of Control
                          wNotifyCode  As Long,  _  ' notification code
                          wID          As Long   _  ' item, control, or accelerator identifer
                          ) As Long

   Local i As Long
   
   Select Case wID
   
     Case %IDC_VLIST1 ' Virtual ListBox notification messages
   
        Select Case wNotifyCode
           Case %VLBN_RETURN
              I = SendMessage(hVList1, %VLB_GETSELECTED, 0, 0)
              If I > -1 Then
                 MessageBox hWndForm, "Enter key pressed on : " & A(I) & Chr$(0), _
                                    "PBVList32 Example test" & Chr$(0), %MB_OK
                 SetFocus hVList1
              End If

           Case %VLBN_SPACE
              I = SendMessage(hVList1, %VLB_GETSELECTED, 0, 0)
              If I > -1 Then
                 MessageBox hWndForm, "Space bar pressed on : " & A(I) & Chr$(0), _
                                    "PBVList32 Example test" & Chr$(0), %MB_OK
                 SetFocus hVList1
              End If

           Case %VLBN_DELETE

           Case %LBN_DBLCLK
              I = SendMessage(hVList1, %VLB_GETSELECTED, 0, 0)
              MessageBox hWndForm, "Double-clicked on : " & A(I) & Chr$(0), _
                                 "PBVList32 Example test" & Chr$(0), %MB_OK
              SetFocus hVList1

           Case %LBN_KILLFOCUS
           Case %LBN_SETFOCUS
           Case %LBN_SELCHANGE
   
        End Select
         
   End Select
   
End Function

Paul Squires
PlanetSquires Software

Marc van Cauwenberghe

#7
Thank you Paul. Just what I needed again. I just found that I had to do it in the WM_COMMAND and not in the _CUSTOM. As is explained in the *.inc file  :-[

Marc