• Welcome to PlanetSquires Forums.
 

CONTROL ADD

Started by A.Smith, November 11, 2005, 04:57:47 PM

Previous topic - Next topic

A.Smith

Hi!

I am a absolute beginner of PB and Firefly.

I wrote a DLL with a form called frmMidi inside. I want to add
a custom control PBSCtrl of Edwin Knoppert (BrowseForFolder- treeview).
I put the code in the start procedure like this

Function CreateForm Alias "CREATEFORM" (ByVal X As Long, ByVal Y As Long, ByVal formWidth As Long, ByVal formHeight As Long) Export As Long
   
   Dim midiError As Long
   Dim Result  As Long
   DIM a           AS LONG
   DIM R           AS Rect
   DIM T           AS STRING
   DIM sPath       AS STRING
   DIM sFile       AS STRING
   DIM pNMHDR      AS NMHDR PTR
   Static nSplit   As Long

   
   If InitPBSoftCtrls() = 0 Then

       MsgBox "No PBSoft controls!"
       Exit Function

   End If
   
   midiError = frmMidi_Show (HWND_FRMMIDI, %FALSE)
   
   PostMessage HWND_FRMMIDI, %WM_SIZE, 0, 0
   
   Control Add "" & $BROWSEFORFOLDER, HWND_FRMMIDI, %ID_BFF, "" _
       , 0, 0, 0, 0 _
       , %WS_CHILD OR %WS_VISIBLE OR %WS_TABSTOP _
         OR %TVS_HASBUTTONS OR %TVS_LINESATROOT OR %TVS_HASLINES _
       , %WS_EX_CLIENTEDGE

   Control Send HWND_FRMMIDI, %ID_BFF, %BFF_EXPANDFIRSTITEM, 1, 0

   Control Add "" & $FOLDERVIEW, HWND_FRMMIDI, %ID_FV, "", 0, 0, 0, 0, _
       %WS_CHILD Or %WS_CLIPSIBLINGS Or %WS_CLIPCHILDREN Or %WS_TABSTOP Or %WS_VISIBLE _
       OR %LVS_REPORT _
       , %WS_EX_CLIENTEDGE


       '// If you like, you can make use of a callback.
       '// This can be handy if you would allow only certain filetypes etc.. (filter)
       SendDlgItemMessage HWND_FRMMIDI, %ID_FV, %FLDV_CALLBACK, CodePtr( FolderView_CustomCallback ), 0
   
   Function = 1                                    

End Function


Unfortunately no control be created.

What goes wrong?

Thank you for your help!!!

Edwin Knoppert2

I think you set the size of the control to 0, 0, 0, 0

Rather small to view properly  :D

TechSupport

Try creating the control using CreateWindowEx.

hWndCtrl = createwindowex( %WS_EX_CLIENTEDGE, bycopy $BROWSEFORFOLDER, _
$BROWSEFORFOLDER, _
%WS_CHILD or %WS_VISIBLE or %WS_TABSTOP or _
%TVS_HASBUTTONS or %TVS_LINESATROOT or _
%TVS_HASLINES, _
100, 100, 100, 100, hWndForm, _
byval %ID_BFF, byval App.hInstance, byval %null)


It worked for me in a sample project that I created.

You should also check out FireFly's built-in FF_BROWSEFORFOLDER function.