PlanetSquires Forums

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: CONTROL ADD  (Read 411 times)

A.Smith

  • Guest
CONTROL ADD
« on: November 11, 2005, 04:57:47 PM »

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!!!
Logged

Edwin Knoppert2

  • Guest
CONTROL ADD
« Reply #1 on: November 11, 2005, 07:02:03 PM »

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

Rather small to view properly  :D
Logged

TechSupport

  • Guest
CONTROL ADD
« Reply #2 on: November 12, 2005, 04:31:39 PM »

Try creating the control using CreateWindowEx.
Code: [Select]

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.
Logged