Jump to content

TreeView Help


Syed23
 Share

Recommended Posts

  • Moderators

Syed23,

A couple of points:

- Firstly, nowhere in your script do you register the _CFF_WM_NOTIFY_Handler which is required to run the UDF (I already pointed this out to you in our last discussion). You already have a WM_NOTIFY handler in the script, so you would need to call the handler directly from within that and not use the _CFF_RegMsg function.

- Secondly and more importantly, you create the treeview in that script with _GUICtrlTreeView_Create - despite the fact the example I posted uses the native GUICtrlCreateTreeView and the UDF specifically mentions passing the ControlID to the UDF and not the handle.

So I am not at all surprised that you cannot get the UDF to work in your script. :rolleyes:

Please take the time to read and understand code you download from the forum before just throwing it into a large complex script and then complaining that it does not work. I have been very patient with you lately, but my interest in helping will begin to run dry soon if you continue like this. ;)

Can you at least run the example script that I posted? :huh:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Replies 75
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

sorry for been like this :( to be hones i ran the example which you have give.. even that does not work for me :( i used only one comb box and select the C: drive that does not list me anything.. i waited more than 5 minutes nothing happened...

sorry again for troubled you..

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

Wait a moment - I am going to put the last few posts into the same thread as we used to debug your other problem yesterday. I will post again when it is done, so do not reply to this.

M23

Edit: OK all moved - now we can discuss your new problem here.

You are telling me that when you copy the UDF and example from the other thread, you cannot make it work - and yet you expect me to debug the UDF in your large script whcih does not even use the UDF correctly. Please be reasonable - I cannot work miracles, I just try to solve problems as they arise. :)

Now let us see what we can do to get you up and running. Copy the UDF and example again and place them both in the same folder. Try to run the example now - but only try the left hand combo for the moment. Any luck? :huh:

M23

Edited by Melba23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

I copied both UDF and example in to same folder and tried. when i select the drive C: the return value which i get is 6 which means Empty tree. This is what happening :(

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

Try this version of the UDF and let me know what you get in the lower SciTE pane when you select the C: drive in the left combo:

#include-once

; #INDEX# ============================================================================================================
; Title .........: ChooseFileFolder
; AutoIt Version : 3.3 +
; Language ......: English
; Description ...: Allows selection of single or multiple files or folders from within a specified path
; Remarks .......: - If the script already has a WM_NOTIFY handler then call the _CFF_WM_NOTIFY_Handler function
;                    from within it
;                  - Requires another Melba23 UDF: RecFileListToArray.au3
; Author ........: Melba23
; Modified ......; Thanks to guinness for help with the #*@#*%# Struct !!!!
; ====================================================================================================================

;#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7

; #INCLUDES# =========================================================================================================
#include <GuiTreeView.au3>
#include "RecFileListToArray.au3"

; #GLOBAL VARIABLES# =================================================================================================
Global $cCFF_Expand_Dummy, $cCFF_DblClk_Dummy

; #CURRENT# ==========================================================================================================
; _CFF_Choose:            Creates a dialog to chose single or multiple files or folders within a specified path
; _CFF_Embed:             Creates the folder tree within an existing treeview
; _CFF_RegMsg:            Registers WM_NOTIFY to action doubleclick and item expansion on TreeView
; _CFF_WM_NOTIFY_Handler: Windows message handler for WM_NOTIFY - reacts to doubleclick and item expansion on TreeView
; ====================================================================================================================

; #INTERNAL_USE_ONLY#=================================================================================================
; _CFF_Combo_Fill:  Creates and fills a combo to allow drive selection
; _CFF_Fill_Branch: Fills a TreeView branch with folders and files on expansion
; ====================================================================================================================

; #FUNCTION# =========================================================================================================
; Name...........: _CFF_Choose
; Description ...: Creates a dialog to chose single or multiple files or folders within a specified path
; Syntax.........: _CFF_Choose ($sTitle, $iW, $iH, $iX, $iY, [$sRoot = "", [$sFile_Mask = "", [$iDisplay = 0, [$iMultiple = True, [$hParent = 0]]]]])
; Parameters ....: $sTitle      - Title of dialog
;                  $iW, $iH     - Width, Height parameters for dialog (Minimum 300 x 130/190 for single/multi selections)
;                  $iX, $iY     - Left, Top parameters for dialog (Default = centred)
;                  $sRoot       - Path tree to display (default = "" - list all drives for selection)
;                  $sFile_Mask  - File name & ext or folder name to match (default = * - match all)
;                  $iDisplay    - Determine what is displayed
;                                 0   - Entire folder tree and all matching files within folders
;                                 1   - All matching files within the specified folder - subfolders are not displayed
;                                 2   - Entire folder tree only - no files.  Doubleclicks will expand, not select, item
;                                 3   - As 2 but doubleclicks will select, not expand, item
;                                 +4  - Do not display Hidden files/folders
;                                 +8  - Do not display System files/folders
;                                 +16 - Hide file extensions (only valid if file mask specifies a single extension)
;                  $iMultiple   - 0     = Only 1 selection (default)
;                                 10-50 = Multiple selections added to list.  Value = list size (10-50% of dialog size)
;                                         Other numeric values = default 20% size. Non-numeric = single selection
;                                         Press "Return" button when selection ended
;                  $hParent     - Handle of GUI calling the dialog, (default = 0 - no parent GUI)
; Requirement(s).: v3.3 +
; Return values .: Success: String containing selected items - multiple items delimited by "|"
;                  Failure: Returns "" and sets @error as follows:
;                           1 = Path does not exist
;                           2 = Invalid $iDisplay parameter
;                           3 = Invalid $hParent parameter
;                           4 = Dialog creation failure
;                           5 = Cancel button or GUI [X] pressed
; Author ........: Melba23
; Modified ......:
; Remarks .......: If files are displayed, only files can be selected
; Example........: Yes
;=====================================================================================================================
Func _CFF_Choose($sTitle, $iW, $iH, $iX = -1, $iY = -1, $sRoot = "", $sFile_Mask = "*", $iDisplay = 0, $iMultiple = 0, $hParent = 0)

    ; Check position
    If $iX = Default Then
        $iX = -1
    EndIf
    If $iY = Default Then
        $iY = -1
    EndIf

    ; Check path
    Switch $sRoot
        Case "", Default
            $sRoot = ""
        Case Else
            If Not FileExists($sRoot) Then
                Return SetError(1, 0, "")
            EndIf
            If StringRight($sRoot, 1) <> "" Then
                $sRoot &= ""
            EndIf
    EndSwitch

    ; Check FileMask
    If $sFile_Mask = Default Then
        $sFile_Mask = "*"
    EndIf

    ; Check Display
    ; Hide file extensions?
    Local $fShow_Ext = True
    If BitAnd($iDisplay, 16) Then
        $iDisplay -= 16
        ; Check that only one ext is specified
        StringReplace($sFile_Mask, ";", "")
        Local $iExt = @extended
        If $sFile_Mask <> "*.*" And $iExt = 0 Then
            ; File exts hidden
            $fShow_Ext = False
        EndIf
    EndIf
    ; Show hiden and system files
    Local $iHide_HS = 0
    If BitAnd($iDisplay, 4) Then
        $iHide_HS += 4
        $iDisplay -= 4
    EndIf
    If BitAnd($iDisplay, 8) Then
        $iHide_HS += 8
        $iDisplay -= 8
    EndIf
    ; Check valid parameter
    Switch $iDisplay
        Case 0 To 3
            ; Valid
        Case Else
            Return SetError(2, 0, "")
    EndSwitch

    ; Check selection type and list size
    Local $fSingle_Sel = False
    Local $iList_Percent = .2
    Switch $iMultiple
        Case 0, Default
            $fSingle_Sel = True
        Case 10 To 50
            $iList_Percent = .01 * $iMultiple
    EndSwitch

    ; Check parent
    Switch $hParent
        Case 0
        Case Else
            If Not IsHWnd($hParent) Then Return SetError(3, 0, "")
    EndSwitch

    ; Check for width and height minima and set button size
    Local $iButton_Width
    If $fSingle_Sel Then
        If $iW < 130 Then $iW = 130
        $iButton_Width = Int(($iW - 30) / 2)
    Else
        If $iW < 190 Then $iW = 190
        $iButton_Width = Int(($iW - 40) / 3)
    EndIf
    If $iButton_Width > 80 Then $iButton_Width = 80
    If $iH < 300 Then $iH = 300

    ; Create dialog
    Local $hCFF_Win = GUICreate($sTitle, $iW, $iH, $iX, $iY, 0x80C80000, -1, $hParent) ; BitOR($WS_POPUPWINDOW, $WS_CAPTION)
    If @error Then Return SetError(4, 0, "")
    GUISetBkColor(0xCECECE)

    ; Declare variables
    Local $hCan_Button, $cSel_Button = 9999, $cAdd_Button = 9999, $cRet_Button = 9999
    Local $cTreeView = 9999, $hTreeView = 9999, $hList = 9999, $hDrive_Combo = 9999
    Local $sCurrDrive = "", $sSelectedPath, $iList_Height, $iTV_Height, $sAddFile_List = ""

    ; Create buttons
    If $fSingle_Sel Then
        $cSel_Button = GUICtrlCreateButton("Select", $iW - ($iButton_Width + 10), $iH - 40, $iButton_Width, 30)
    Else
        $cAdd_Button = GUICtrlCreateButton("Add", 10, $iH - 40, $iButton_Width, 30)
        $cRet_Button = GUICtrlCreateButton("Return", $iW - ($iButton_Width + 10), $iH - 40, $iButton_Width, 30)
    EndIf
    $hCan_Button = GUICtrlCreateButton("Cancel", $iW - ($iButton_Width + 10) * 2, $iH - 40, $iButton_Width, 30)

    ; Create controls
    Select
        Case $sRoot And $fSingle_Sel ; TV only
            ; Create TV and hide
            $cTreeView = GUICtrlCreateTreeView(10, 10, $iW - 20, $iH - 60)
            $hTreeView = GUICtrlGetHandle($cTreeView)
            GUICtrlSetState(-1, 32) ; $GUI_HIDE

        Case Not $sRoot And $fSingle_Sel ; Combo and TV
            ; Create and fill Combo
            $hDrive_Combo = _CFF_Combo_Fill($iW)
            ; Create TV and hide
            $cTreeView = GUICtrlCreateTreeView(10, 40, $iW - 20, $iH - 90)
            $hTreeView = GUICtrlGetHandle($cTreeView)
            GUICtrlSetState(-1, 32) ; $GUI_HIDE

        Case $sRoot And Not $fSingle_Sel ; TV and List
            ; Calculate control heights
            $iList_Height = Int(($iH - 60) * $iList_Percent)
            If $iList_Height < 40 Then
                $iList_Height = 40
            EndIf
            $iTV_Height = $iH - $iList_Height - 60
            ; Create TV and hide
            $cTreeView = GUICtrlCreateTreeView(10, 10, $iW - 20, $iTV_Height)
            $hTreeView = GUICtrlGetHandle($cTreeView)
            GUICtrlSetState(-1, 32) ; $GUI_HIDE
            ; Create List
            $hList = GUICtrlCreateList("", 10, 10 + $iTV_Height, $iW - 20, $iList_Height, 0x00A04100) ;BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOSEL, $LBS_NOINTEGRALHEIGHT))

        Case Not $sRoot And Not $fSingle_Sel ; Combo, TV and List
            ; Calculate control heights
            $iList_Height = Int(($iH - 90) * $iList_Percent)
            If $iList_Height < 40 Then
                $iList_Height = 40
            EndIf
            $iTV_Height = $iH - $iList_Height - 90
            ; Create and fill Combo
            $hDrive_Combo = _CFF_Combo_Fill($iW)
            ; Create TV and hide
            $cTreeView = GUICtrlCreateTreeView(10, 40, $iW - 20, $iTV_Height)
            $hTreeView = GUICtrlGetHandle($cTreeView)
            GUICtrlSetState(-1, 32) ; $GUI_HIDE
            ; Create List
            $hList = GUICtrlCreateList("", 10, 40 + $iTV_Height, $iW - 20, $iList_Height, 0x00A04100) ;BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOSEL, $LBS_NOINTEGRALHEIGHT))
    EndSelect

    ; Create dummy control to fire when [+] clicked
    $cCFF_Expand_Dummy = GUICtrlCreateDummy()
    ; Create dummy control to for on DblClk
    $cCFF_DblClk_Dummy = GUICtrlCreateDummy()

    ; Display dialog
    GUISetState()

    If $sRoot Then
        ; If root folder specified then fill TV
        _CFF_Fill_Branch($hTreeView, $cTreeView, $sRoot, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS)
        ; Show TV
        GUICtrlSetState($cTreeView, 16) ; $GUI_SHOW
    EndIf

    ; Change to MessageLoop mode
    Local $nOldOpt = Opt('GUIOnEventMode', 0)

    While 1

        Switch GUIGetMsg()
            Case $hCan_Button, -3 ; $GUI_EVENT_CLOSE
                GUIDelete($hCFF_Win)
                ; Restore previous mode
                Opt('GUIOnEventMode', $nOldOpt)
                Return SetError(5, 0, "")

            Case $cCFF_DblClk_Dummy
                ; Check doubleclicks are permitted (not default for folders only)
                If $iDisplay <> 2 Then
                    ContinueCase
                EndIf

            Case $cSel_Button, $cAdd_Button
                ; Get item data
                Local $cItem = GUICtrlRead($cTreeView)
                Local $hItem = GUICtrlGetHandle($cItem)
                ; Determine item path
                $sSelectedPath = $sRoot & StringReplace(_GUICtrlTreeView_GetTree($hTreeView, $hItem), "|", "")
                ; Check path is a valid selection
                Switch $iDisplay
                    Case 2
                        ; Folders only
                    Case Else
                        ; Files only
                        StringReplace(FileGetAttrib($sSelectedPath), "D", "")
                        ; Is it a folder?
                        If @extended Then
                            $sSelectedPath = ""
                        EndIf
                        ; Hide extension?
                        If $fShow_Ext = False Then
                            $sSelectedPath &= StringTrimLeft($sFile_Mask, 1)
                        EndIf
                EndSwitch
                If $sSelectedPath Then
                    ; Valid item selected
                    If $fSingle_Sel Then
                        GUIDelete($hCFF_Win)
                        ; Restore previous mode
                        Opt('GUIOnEventMode', $nOldOpt)
                        ; Return valid path
                        Return $sSelectedPath
                    Else
                        ; Add to return string
                        $sAddFile_List &= $sSelectedPath & "|"
                        ; Add to onscreen list
                        GUICtrlSendMsg($hList, 0x0180, 0, $sSelectedPath) ; $LB_ADDSTRING
                        ; Scroll to bottom of list
                        GUICtrlSendMsg($hList, 0x197, GUICtrlSendMsg($hList, 0x18B, 0, 0) - 1, 0) ; $LB_SETTOPINDEX, $LB_GETCOUNT
                        ; Return focus to TV
                        GUICtrlSetState($cTreeView, 256) ; $GUI_FOCUS
                    EndIf
                EndIf

            Case $cRet_Button
                GUIDelete($hCFF_Win)
                ; Restore previous mode
                Opt('GUIOnEventMode', $nOldOpt)
                ; Remove final | from return string and return
                Return StringTrimRight($sAddFile_List, 1)

            Case $cCFF_Expand_Dummy
                ; Get expanded item hamdle
                $hItem = GUICtrlRead($cCFF_Expand_Dummy)
                If $hItem Then
                    ; Select item
                    _GUICtrlTreeView_ClickItem($hTreeView, $hItem)
                    ; Get expanded item data
                    $cItem = GUICtrlRead($cTreeView)
                    $hItem = GUICtrlGetHandle($cItem)
                    $sSelectedPath = $sRoot & StringReplace(_GUICtrlTreeView_GetTree($cTreeView, $hItem), "|", "")
                    ; Check if dummy child exists or has already been filled
                    Local $hFirstChild = _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem)
                    Local $sFirstChild = _GUICtrlTreeView_GetText($hTreeView, $hFirstChild)
                    ; If dummy child exists
                    If $sFirstChild = "" Then
                        ; Fill with content
                        _CFF_Fill_Branch($hTreeView, $cItem, $sSelectedPath, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS)
                        ; Delete the dummy
                        _GUICtrlTreeView_Delete($hTreeView, $hFirstChild)
                    ;Else
                        ; Either already filled or empty
                    EndIf
                    ; Clear the flag to reactivate the handler
                    GUICtrlSendToDummy($cCFF_Expand_Dummy, 0)
                EndIf

            Case $hDrive_Combo
                If GUICtrlRead($hDrive_Combo) <> $sCurrDrive Then
                    ; Get drive chosen
                    $sCurrDrive = GUICtrlRead($hDrive_Combo)
                    If $sRoot Then
                        ; Delete current content
                        _GUICtrlTreeView_DeleteAll($hTreeView)
                    Else
                        ; Show TV
                        GUICtrlSetState($cTreeView, 16) ; $GUI_SHOW
                    EndIf
                    ; Set root path
                    $sRoot = $sCurrDrive & ""
                    ; Fill TV
                    _CFF_Fill_Branch($hTreeView, $cTreeView, $sRoot, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS)
                EndIf

        EndSwitch

    WEnd

EndFunc   ;==>_CFF_Choose

; #FUNCTION# =========================================================================================================
; Name...........: _CFF_Embed
; Description ...: Creates the folder tree within an existing treeview
; Syntax.........: _CFF_Embed ($cTreeView, $sRoot[, $sFile_Mask = "*"[, $iDisplay = 0[, $cReturn = 9999[, $cList = 0]]])
; Parameters ....: $cTreeView   - ControlID of TreeView to use
;                  $sRoot       - Path tree to display
;                  $sFile_Mask  - File name & ext or folder name to match (default = * - match all)
;                  $iDisplay    - Determine what is displayed
;                                 0   - Entire folder tree and all matching files within folders
;                                 1   - All matching files within the specified folder - subfolders are not displayed
;                                 2   - Entire folder tree only - no files.  Doubleclicks will expand, not select, item
;                                 3   - As 2 but doubleclicks will select, not expand, item
;                                 +4  - Do not display Hidden files/folders
;                                 +8  - Do not display System files/folders
;                                 +16 - Hide file extensions (only valid if file mask specifies a single extension)
;                  $cReturn     - ControlID of control to end multipler selection - multiple selection if specified
;                  $cList       - [Optional] List to fill with multiple selections
; Requirement(s).: v3.3 +
; Return values .: Success: Single selection = String containing selected item
;                           Multi selection  = String of selected items delimited by "|"
;                  Failure: Returns "" and sets @error as follows:
;                           1 = Invalid TreeView ControlID
;                           2 = Path does not exist
;                           3 = Invalid $iDisplay parameter
;                           4 = Invalid $cList ControlID
;                           5 = Invalid or missing $cReturn ControlID
;                           6 = Empty tree
; Author ........: Melba23
; Modified ......:
; Remarks .......: - If files are displayed, only files can be selected
;                  - Press ESC to cancel selection
; Example........: Yes
;=====================================================================================================================
Func _CFF_Embed($cTreeView, $sRoot, $sFile_Mask = "*", $iDisplay = 0, $cReturn = 9999, $cList = 0)

    If Not IsHWnd(GUICtrlGetHandle($cTreeView)) Then
        Return SetError(1, 0, "")
    Else
        $hTreeView = GUICtrlGetHandle($cTreeView)
    EndIf

    If Not FileExists($sRoot) Then
        Return SetError(2, 0, "")
    EndIf
    If StringRight($sRoot, 1) <> "" Then
        $sRoot &= ""
    EndIf

    ; Check FileMask
    If $sFile_Mask = Default Then
        $sFile_Mask = "*"
    EndIf

    ; Check Display
    ; Hide file extensions?
    Local $fShow_Ext = True
    If BitAnd($iDisplay, 16) Then
        $iDisplay -= 16
        ; Check that only one ext is specified
        StringReplace($sFile_Mask, ";", "")
        Local $iExt = @extended
        If StringRight($sFile_Mask, 1) <> "*" And $iExt = 0 Then
            ; File exts hidden
            $fShow_Ext = False
        EndIf
    EndIf
    ; Show hiden and system files
    Local $iHide_HS = 0
    If BitAnd($iDisplay, 4) Then
        $iHide_HS += 4
        $iDisplay -= 4
    EndIf
    If BitAnd($iDisplay, 8) Then
        $iHide_HS += 8
        $iDisplay -= 8
    EndIf
    ; Check valid parameter
    Switch $iDisplay
        Case 0 To 3
            ; Valid
        Case Else
            Return SetError(3, 0, "")
    EndSwitch

    ; Check return control
    Local $sAddFile_List = ""
    Local $fSingle_Sel = True
    Switch $cReturn
        Case 9999
            ; Single select
        Case Else
            ; Check if valid ControlID
            If Not IsHWnd(GUICtrlGetHandle($cReturn)) Then
                Return SetError(4, 0, "")
            Else
                ; Multi select
                $fSingle_Sel = False
            EndIf
    EndSwitch

    ; If list passed check if valid ControlID
    If $cList And Not IsHWnd(GUICtrlGetHandle($cList)) Then
        Return SetError(5, 0, "")
    EndIf

    ; Create dummy control to fire when [+] clicked
    $cCFF_Expand_Dummy = GUICtrlCreateDummy()
    ; Create dummy control to for on DblClk
    $cCFF_DblClk_Dummy = GUICtrlCreateDummy()

    ConsoleWrite("Params: " & @CRLF & $hTreeView & @CRLF & $cTreeView & @CRLF & $sRoot & @CRLF & $iDisplay & @CRLF & $sFile_Mask & @CRLF & $fShow_Ext & @CRLF & $iHide_HS & @CRLF)

    ; Fill treeview
    If Not _CFF_Fill_Branch($hTreeView, $cTreeView, $sRoot, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS) Then
        Return SetError(6, 0, "")
    EndIf

    ; Open DLL
    $hDLL = "user32.dll"

    ; Change to MessageLoop mode
    Local $nOldOpt = Opt('GUIOnEventMode', 0)

    While 1

        Switch GUIGetMsg()
            Case $cReturn
                ; Clear treeview and list
                _GUICtrlTreeView_DeleteAll($cTreeView)
                GUICtrlSetData($cList, "|")
                ; Closee DLL
                DllClose($hDLL)
                ; Restore previous mode
                Opt('GUIOnEventMode', $nOldOpt)
                ; Return list of files selected
                Return $sAddFile_List

            Case $cCFF_DblClk_Dummy
                ; Check doubleclicks are permitted (not default for folders only)
                If $iDisplay <> 2 Then
                    ; Get item data
                    Local $cItem = GUICtrlRead($cTreeView)
                    Local $hItem = GUICtrlGetHandle($cItem)
                    ; Determine item path
                    $sSelectedPath = $sRoot & StringReplace(_GUICtrlTreeView_GetTree($hTreeView, $hItem), "|", "")
                    ; Check path is a valid selection
                    Switch $iDisplay
                        Case 2
                            ; Folders only
                        Case Else
                            ; Files only
                            StringReplace(FileGetAttrib($sSelectedPath), "D", "")
                            ; Is it a folder?
                            If @extended Then
                                $sSelectedPath = ""
                            EndIf
                            ; Hide extension?
                            If $fShow_Ext = False Then
                                $sSelectedPath &= StringTrimLeft($sFile_Mask, 1)
                            EndIf
                    EndSwitch
                    If $sSelectedPath Then
                        ; Valid item selected
                        If $fSingle_Sel Then
                            ; Clear treeview
                            _GUICtrlTreeView_DeleteAll($cTreeView)
                            ; Closee DLL
                            DllClose($hDLL)
                            ; Restore previous mode
                            Opt('GUIOnEventMode', $nOldOpt)
                            ; Return valid path
                            Return $sSelectedPath
                        Else
                            ; Add to return string
                            $sAddFile_List &= $sSelectedPath & "|"
                            ; Add to onscreen list
                            GUICtrlSendMsg($cList, 0x0180, 0, $sSelectedPath) ; $LB_ADDSTRING
                            ; Scroll to bottom of list
                            GUICtrlSendMsg($cList, 0x197, GUICtrlSendMsg($cList, 0x18B, 0, 0) - 1, 0) ; $LB_SETTOPINDEX, $LB_GETCOUNT
                            ; Return focus to TV
                            GUICtrlSetState($cTreeView, 256) ; $GUI_FOCUS
                        EndIf
                    EndIf
                EndIf

            Case $cCFF_Expand_Dummy
                ; Get expanded item hamdle
                $hItem = GUICtrlRead($cCFF_Expand_Dummy)
                If $hItem Then
                    ; Select item
                    _GUICtrlTreeView_ClickItem($hTreeView, $hItem)
                    ; Get expanded item data
                    $cItem = GUICtrlRead($cTreeView)
                    $hItem = GUICtrlGetHandle($cItem)
                    $sSelectedPath = $sRoot & StringReplace(_GUICtrlTreeView_GetTree($cTreeView, $hItem), "|", "")
                    ; Check if dummy child exists or has already been filled
                    Local $hFirstChild = _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem)
                    Local $sFirstChild = _GUICtrlTreeView_GetText($hTreeView, $hFirstChild)
                    ; If dummy child exists
                    If $sFirstChild = "" Then
                        ; Fill with content
                        _CFF_Fill_Branch($hTreeView, $cItem, $sSelectedPath, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS)
                        ; Delete the dummy
                        _GUICtrlTreeView_Delete($hTreeView, $hFirstChild)
                    ;Else
                        ; Either already filled or empty
                    EndIf
                    ; Clear the flag to reactivate the handler
                    GUICtrlSendToDummy($cCFF_Expand_Dummy, 0)
                EndIf
        EndSwitch

        ; Look for ESC key to cancel
        Local $aDLL_Ret = DllCall($hDLL, "short", "GetAsyncKeyState", "int", '0x1B')
        If IsArray($aDLL_Ret) And BitAND($aDLL_Ret[0], 0x8000) Then
            ; Clear treeview
            _GUICtrlTreeView_DeleteAll($cTreeView)
            ; Closee DLL
            DllClose($hDLL)
            ; Restore previous mode
            Opt('GUIOnEventMode', $nOldOpt)
            ; Return
            Return SetError(7, 0, "")
        EndIf

    WEnd

EndFunc

; #FUNCTION# =========================================================================================================
; Name...........: _CFF_RegMsg
; Description ...: Registers WM_NOTIFY to action doubleclick and item expansion on TreeView
; Syntax.........: _CFF_RegMsg()
; Parameteres....: None
; Requirement(s).: v3.3 +
; Return values .: Success: 1
;                  Failure: 0
; Author ........: Melba23
; Modified ......:
; Remarks .......: If the script already has a WM_NOTIFY handler then call the _CFF_WM_NOTIFY_Handler function
;                  from within it
; Example........: Yes
;=====================================================================================================================
Func _CFF_RegMsg()

    Return GUIRegisterMsg(0x004E, "_CFF_WM_NOTIFY_Handler") ; $WM_NOTIFY

EndFunc   ;==>_CFF_RegMsg

; #FUNCTION# =========================================================================================================
; Name...........: _CFF_WM_NOTIFY_Handler
; Description ...: Windows message handler for WM_NOTIFY - reacts to doubleclick and item expansion on TreeView
; Syntax.........: _CFF_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)
; Requirement(s).: v3.3 +
; Return values..: None
; Author ........: Melba23 - thanks to guinness for help with the #*@#*%# Struct !!!!
; Modified ......:
; Remarks .......: If a WM_NOTIFY handler already registered, then call this function from within that handler
; Example........: Yes
;=====================================================================================================================
Func _CFF_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $wParam

    Local $tStruct = DllStructCreate("struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct;" & _
        "uint Action;struct;uint OldMask;handle OldhItem;uint OldState;uint OldStateMask;" & _
        "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;lparam OldParam;endstruct;" & _
        "struct;uint NewMask;handle NewhItem;uint NewState;uint NewStateMask;" & _
        "ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;lparam NewParam;endstruct;" & _
        "struct;long PointX;long PointY;endstruct", $lParam)
    Local $hItem = DllStructGetData($tStruct, 'NewhItem')
    Local $ID = DllStructGetData($tStruct, 'Code')
    Switch $ID
        Case 0xFFFFFFFD ; $NM_DBLCLK
            ; Fire the dummy control
            GUICtrlSendToDummy($cCFF_DblClk_Dummy)
        Case $TVN_ITEMEXPANDEDW, $TVN_ITEMEXPANDEDA
            ; Check that expansion is not ongoing
            If GUICtrlRead($cCFF_Expand_Dummy) = 0 Then
                ; Fire the dummy control
                GUICtrlSendToDummy($cCFF_Expand_Dummy, $hItem)
            EndIf
    EndSwitch

EndFunc   ;==>_CFF_WM_NOTIFY_Handler

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: _CFF_Combo_Fill
; Description ...: Creates and fills a combo to allow drive selection.
; Author ........: Melba23
; Remarks .......:
; ===============================================================================================================================
Func _CFF_Combo_Fill($iW)

    Local $iInset = Int(($iW - 170) / 2)

    GUICtrlCreateLabel("Select Drive:", 10 + $iInset, 15, 65, 20)
    Local $hCombo = GUICtrlCreateCombo("", 75 + $iInset, 10, 50, 20)
    Local $aDrives = DriveGetDrive("ALL")
    For $i = 1 To $aDrives[0]
        ; Only display ready drives
        If DriveStatus($aDrives[$i] & '') <> "NOTREADY" Then GUICtrlSetData($hCombo, StringUpper($aDrives[$i]))
    Next
    Return $hCombo

EndFunc   ;==>_CFF_Combo_Fill

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: _CFF_Fill_Branch
; Description ...: Fills a TreeView branch with folders and files on expansion
; Author ........: Melba23
; Remarks .......:
; ===============================================================================================================================
Func _CFF_Fill_Branch($hTV, $cParent, $sPath, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS)

    Local $sItem, $cItem, $hSearch, $FFound = False

    If StringRight($sPath, 1) <> "" Then
        $sPath &= ""
    EndIf

    _GUICtrlTreeView_BeginUpdate($hTV)
    Switch $iDisplay
        Case 0, 2, 3
            ; List folders
            Local $aContent = _RecFileListToArray($sPath, "*", 2 + $iHide_HS, 0, 1, 1)
            If IsArray($aContent) Then
                For $i = 1 To $aContent[0]
                    ; Remove trailing  if needed
                    $sItem = $aContent[$i]
                    If StringRight($sItem, 1) = "" Then
                        $sItem = StringTrimRight($sItem, 1)
                    EndIf
                    ; Create item
                    $cItem = GUICtrlCreateTreeViewItem($sItem, $cParent)
                    ; Look for content within the folder
                    FileChangeDir($sPath & $aContent[$i])
                    $hSearch = FileFindFirstFile("*.*")
                    ; If there is something
                    If $hSearch <> -1 Then
                        ; Set flag
                        $FFound = True
                        ; Need to determine type of content?
                        Switch $iDisplay
                            Case 0 ; Either folder or file
                                ; Create dummy child to force [+] display
                                GUICtrlCreateTreeViewItem("", $cItem)
                            Case Else
                                While 1
                                    FileFindNextFile($hSearch)
                                    ; End of content
                                    If @error Then ExitLoop
                                    Local $iExtended = @extended
                                    Switch $iDisplay
                                        Case 1 ; Files only
                                            If Not $iExtended Then
                                                ; Found file
                                                GUICtrlCreateTreeViewItem("", $cItem)
                                                ; No need to look further
                                                ExitLoop
                                            EndIf
                                        Case Else ; Folders only
                                            If $iExtended Then
                                                ; Found folder
                                                GUICtrlCreateTreeViewItem("", $cItem)
                                                ; No need to look further
                                                ExitLoop
                                            EndIf
                                    EndSwitch
                                WEnd
                                ; Close search
                                FileClose($hSearch)
                        EndSwitch
                    EndIf
                    FileChangeDir(@ScriptDir)
                Next
            EndIf
    EndSwitch
    Switch $iDisplay
        Case 0, 1
            ; List files
            $aContent = _RecFileListToArray($sPath, $sFile_Mask, 1 + $iHide_HS, 0, 1)
            If IsArray($aContent) Then
                ; Set flag
                $FFound = True
                For $i = 1 To $aContent[0]
                    $sItem = $aContent[$i]
                    ; Remove extension if required
                    If Not $fShow_Ext Then
                        $sItem = StringRegExpReplace($sItem, "(.*)..*", "$1")
                    EndIf
                    ; Create item
                    GUICtrlCreateTreeViewItem($sItem, $cParent)
                Next
            EndIf
    EndSwitch
    _GUICtrlTreeView_EndUpdate($hTV)

    Return $fFound

EndFunc   ;==>_CFF_Fill_Branch

I get this - let us see what you get: :)

Params: 
0x00100982
5
C:
0
*.*
True
12

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Syed23,

And now this one: :)

#include-once

; #INDEX# ============================================================================================================
; Title .........: ChooseFileFolder
; AutoIt Version : 3.3 +
; Language ......: English
; Description ...: Allows selection of single or multiple files or folders from within a specified path
; Remarks .......: - If the script already has a WM_NOTIFY handler then call the _CFF_WM_NOTIFY_Handler function
;                    from within it
;                  - Requires another Melba23 UDF: RecFileListToArray.au3
; Author ........: Melba23
; Modified ......; Thanks to guinness for help with the #*@#*%# Struct !!!!
; ====================================================================================================================

;#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w- 4 -w 5 -w 6 -w- 7

; #INCLUDES# =========================================================================================================
#include <GuiTreeView.au3>
#include "RecFileListToArray.au3"

; #GLOBAL VARIABLES# =================================================================================================
Global $cCFF_Expand_Dummy, $cCFF_DblClk_Dummy

; #CURRENT# ==========================================================================================================
; _CFF_Choose:            Creates a dialog to chose single or multiple files or folders within a specified path
; _CFF_Embed:             Creates the folder tree within an existing treeview
; _CFF_RegMsg:            Registers WM_NOTIFY to action doubleclick and item expansion on TreeView
; _CFF_WM_NOTIFY_Handler: Windows message handler for WM_NOTIFY - reacts to doubleclick and item expansion on TreeView
; ====================================================================================================================

; #INTERNAL_USE_ONLY#=================================================================================================
; _CFF_Combo_Fill:  Creates and fills a combo to allow drive selection
; _CFF_Fill_Branch: Fills a TreeView branch with folders and files on expansion
; ====================================================================================================================

; #FUNCTION# =========================================================================================================
; Name...........: _CFF_Choose
; Description ...: Creates a dialog to chose single or multiple files or folders within a specified path
; Syntax.........: _CFF_Choose ($sTitle, $iW, $iH, $iX, $iY, [$sRoot = "", [$sFile_Mask = "", [$iDisplay = 0, [$iMultiple = True, [$hParent = 0]]]]])
; Parameters ....: $sTitle      - Title of dialog
;                  $iW, $iH     - Width, Height parameters for dialog (Minimum 300 x 130/190 for single/multi selections)
;                  $iX, $iY     - Left, Top parameters for dialog (Default = centred)
;                  $sRoot       - Path tree to display (default = "" - list all drives for selection)
;                  $sFile_Mask  - File name & ext or folder name to match (default = * - match all)
;                  $iDisplay    - Determine what is displayed
;                                 0   - Entire folder tree and all matching files within folders
;                                 1   - All matching files within the specified folder - subfolders are not displayed
;                                 2   - Entire folder tree only - no files.  Doubleclicks will expand, not select, item
;                                 3   - As 2 but doubleclicks will select, not expand, item
;                                 +4  - Do not display Hidden files/folders
;                                 +8  - Do not display System files/folders
;                                 +16 - Hide file extensions (only valid if file mask specifies a single extension)
;                  $iMultiple   - 0     = Only 1 selection (default)
;                                 10-50 = Multiple selections added to list.  Value = list size (10-50% of dialog size)
;                                         Other numeric values = default 20% size. Non-numeric = single selection
;                                         Press "Return" button when selection ended
;                  $hParent     - Handle of GUI calling the dialog, (default = 0 - no parent GUI)
; Requirement(s).: v3.3 +
; Return values .: Success: String containing selected items - multiple items delimited by "|"
;                  Failure: Returns "" and sets @error as follows:
;                           1 = Path does not exist
;                           2 = Invalid $iDisplay parameter
;                           3 = Invalid $hParent parameter
;                           4 = Dialog creation failure
;                           5 = Cancel button or GUI [X] pressed
; Author ........: Melba23
; Modified ......:
; Remarks .......: If files are displayed, only files can be selected
; Example........: Yes
;=====================================================================================================================
Func _CFF_Choose($sTitle, $iW, $iH, $iX = -1, $iY = -1, $sRoot = "", $sFile_Mask = "*", $iDisplay = 0, $iMultiple = 0, $hParent = 0)

    ; Check position
    If $iX = Default Then
        $iX = -1
    EndIf
    If $iY = Default Then
        $iY = -1
    EndIf

    ; Check path
    Switch $sRoot
        Case "", Default
            $sRoot = ""
        Case Else
            If Not FileExists($sRoot) Then
                Return SetError(1, 0, "")
            EndIf
            If StringRight($sRoot, 1) <> "" Then
                $sRoot &= ""
            EndIf
    EndSwitch

    ; Check FileMask
    If $sFile_Mask = Default Then
        $sFile_Mask = "*"
    EndIf

    ; Check Display
    ; Hide file extensions?
    Local $fShow_Ext = True
    If BitAnd($iDisplay, 16) Then
        $iDisplay -= 16
        ; Check that only one ext is specified
        StringReplace($sFile_Mask, ";", "")
        Local $iExt = @extended
        If $sFile_Mask <> "*.*" And $iExt = 0 Then
            ; File exts hidden
            $fShow_Ext = False
        EndIf
    EndIf
    ; Show hiden and system files
    Local $iHide_HS = 0
    If BitAnd($iDisplay, 4) Then
        $iHide_HS += 4
        $iDisplay -= 4
    EndIf
    If BitAnd($iDisplay, 8) Then
        $iHide_HS += 8
        $iDisplay -= 8
    EndIf
    ; Check valid parameter
    Switch $iDisplay
        Case 0 To 3
            ; Valid
        Case Else
            Return SetError(2, 0, "")
    EndSwitch

    ; Check selection type and list size
    Local $fSingle_Sel = False
    Local $iList_Percent = .2
    Switch $iMultiple
        Case 0, Default
            $fSingle_Sel = True
        Case 10 To 50
            $iList_Percent = .01 * $iMultiple
    EndSwitch

    ; Check parent
    Switch $hParent
        Case 0
        Case Else
            If Not IsHWnd($hParent) Then Return SetError(3, 0, "")
    EndSwitch

    ; Check for width and height minima and set button size
    Local $iButton_Width
    If $fSingle_Sel Then
        If $iW < 130 Then $iW = 130
        $iButton_Width = Int(($iW - 30) / 2)
    Else
        If $iW < 190 Then $iW = 190
        $iButton_Width = Int(($iW - 40) / 3)
    EndIf
    If $iButton_Width > 80 Then $iButton_Width = 80
    If $iH < 300 Then $iH = 300

    ; Create dialog
    Local $hCFF_Win = GUICreate($sTitle, $iW, $iH, $iX, $iY, 0x80C80000, -1, $hParent) ; BitOR($WS_POPUPWINDOW, $WS_CAPTION)
    If @error Then Return SetError(4, 0, "")
    GUISetBkColor(0xCECECE)

    ; Declare variables
    Local $hCan_Button, $cSel_Button = 9999, $cAdd_Button = 9999, $cRet_Button = 9999
    Local $cTreeView = 9999, $hTreeView = 9999, $hList = 9999, $hDrive_Combo = 9999
    Local $sCurrDrive = "", $sSelectedPath, $iList_Height, $iTV_Height, $sAddFile_List = ""

    ; Create buttons
    If $fSingle_Sel Then
        $cSel_Button = GUICtrlCreateButton("Select", $iW - ($iButton_Width + 10), $iH - 40, $iButton_Width, 30)
    Else
        $cAdd_Button = GUICtrlCreateButton("Add", 10, $iH - 40, $iButton_Width, 30)
        $cRet_Button = GUICtrlCreateButton("Return", $iW - ($iButton_Width + 10), $iH - 40, $iButton_Width, 30)
    EndIf
    $hCan_Button = GUICtrlCreateButton("Cancel", $iW - ($iButton_Width + 10) * 2, $iH - 40, $iButton_Width, 30)

    ; Create controls
    Select
        Case $sRoot And $fSingle_Sel ; TV only
            ; Create TV and hide
            $cTreeView = GUICtrlCreateTreeView(10, 10, $iW - 20, $iH - 60)
            $hTreeView = GUICtrlGetHandle($cTreeView)
            GUICtrlSetState(-1, 32) ; $GUI_HIDE

        Case Not $sRoot And $fSingle_Sel ; Combo and TV
            ; Create and fill Combo
            $hDrive_Combo = _CFF_Combo_Fill($iW)
            ; Create TV and hide
            $cTreeView = GUICtrlCreateTreeView(10, 40, $iW - 20, $iH - 90)
            $hTreeView = GUICtrlGetHandle($cTreeView)
            GUICtrlSetState(-1, 32) ; $GUI_HIDE

        Case $sRoot And Not $fSingle_Sel ; TV and List
            ; Calculate control heights
            $iList_Height = Int(($iH - 60) * $iList_Percent)
            If $iList_Height < 40 Then
                $iList_Height = 40
            EndIf
            $iTV_Height = $iH - $iList_Height - 60
            ; Create TV and hide
            $cTreeView = GUICtrlCreateTreeView(10, 10, $iW - 20, $iTV_Height)
            $hTreeView = GUICtrlGetHandle($cTreeView)
            GUICtrlSetState(-1, 32) ; $GUI_HIDE
            ; Create List
            $hList = GUICtrlCreateList("", 10, 10 + $iTV_Height, $iW - 20, $iList_Height, 0x00A04100) ;BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOSEL, $LBS_NOINTEGRALHEIGHT))

        Case Not $sRoot And Not $fSingle_Sel ; Combo, TV and List
            ; Calculate control heights
            $iList_Height = Int(($iH - 90) * $iList_Percent)
            If $iList_Height < 40 Then
                $iList_Height = 40
            EndIf
            $iTV_Height = $iH - $iList_Height - 90
            ; Create and fill Combo
            $hDrive_Combo = _CFF_Combo_Fill($iW)
            ; Create TV and hide
            $cTreeView = GUICtrlCreateTreeView(10, 40, $iW - 20, $iTV_Height)
            $hTreeView = GUICtrlGetHandle($cTreeView)
            GUICtrlSetState(-1, 32) ; $GUI_HIDE
            ; Create List
            $hList = GUICtrlCreateList("", 10, 40 + $iTV_Height, $iW - 20, $iList_Height, 0x00A04100) ;BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOSEL, $LBS_NOINTEGRALHEIGHT))
    EndSelect

    ; Create dummy control to fire when [+] clicked
    $cCFF_Expand_Dummy = GUICtrlCreateDummy()
    ; Create dummy control to for on DblClk
    $cCFF_DblClk_Dummy = GUICtrlCreateDummy()

    ; Display dialog
    GUISetState()

    If $sRoot Then
        ; If root folder specified then fill TV
        _CFF_Fill_Branch($hTreeView, $cTreeView, $sRoot, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS)
        ; Show TV
        GUICtrlSetState($cTreeView, 16) ; $GUI_SHOW
    EndIf

    ; Change to MessageLoop mode
    Local $nOldOpt = Opt('GUIOnEventMode', 0)

    While 1

        Switch GUIGetMsg()
            Case $hCan_Button, -3 ; $GUI_EVENT_CLOSE
                GUIDelete($hCFF_Win)
                ; Restore previous mode
                Opt('GUIOnEventMode', $nOldOpt)
                Return SetError(5, 0, "")

            Case $cCFF_DblClk_Dummy
                ; Check doubleclicks are permitted (not default for folders only)
                If $iDisplay <> 2 Then
                    ContinueCase
                EndIf

            Case $cSel_Button, $cAdd_Button
                ; Get item data
                Local $cItem = GUICtrlRead($cTreeView)
                Local $hItem = GUICtrlGetHandle($cItem)
                ; Determine item path
                $sSelectedPath = $sRoot & StringReplace(_GUICtrlTreeView_GetTree($hTreeView, $hItem), "|", "")
                ; Check path is a valid selection
                Switch $iDisplay
                    Case 2
                        ; Folders only
                    Case Else
                        ; Files only
                        StringReplace(FileGetAttrib($sSelectedPath), "D", "")
                        ; Is it a folder?
                        If @extended Then
                            $sSelectedPath = ""
                        EndIf
                        ; Hide extension?
                        If $fShow_Ext = False Then
                            $sSelectedPath &= StringTrimLeft($sFile_Mask, 1)
                        EndIf
                EndSwitch
                If $sSelectedPath Then
                    ; Valid item selected
                    If $fSingle_Sel Then
                        GUIDelete($hCFF_Win)
                        ; Restore previous mode
                        Opt('GUIOnEventMode', $nOldOpt)
                        ; Return valid path
                        Return $sSelectedPath
                    Else
                        ; Add to return string
                        $sAddFile_List &= $sSelectedPath & "|"
                        ; Add to onscreen list
                        GUICtrlSendMsg($hList, 0x0180, 0, $sSelectedPath) ; $LB_ADDSTRING
                        ; Scroll to bottom of list
                        GUICtrlSendMsg($hList, 0x197, GUICtrlSendMsg($hList, 0x18B, 0, 0) - 1, 0) ; $LB_SETTOPINDEX, $LB_GETCOUNT
                        ; Return focus to TV
                        GUICtrlSetState($cTreeView, 256) ; $GUI_FOCUS
                    EndIf
                EndIf

            Case $cRet_Button
                GUIDelete($hCFF_Win)
                ; Restore previous mode
                Opt('GUIOnEventMode', $nOldOpt)
                ; Remove final | from return string and return
                Return StringTrimRight($sAddFile_List, 1)

            Case $cCFF_Expand_Dummy
                ; Get expanded item hamdle
                $hItem = GUICtrlRead($cCFF_Expand_Dummy)
                If $hItem Then
                    ; Select item
                    _GUICtrlTreeView_ClickItem($hTreeView, $hItem)
                    ; Get expanded item data
                    $cItem = GUICtrlRead($cTreeView)
                    $hItem = GUICtrlGetHandle($cItem)
                    $sSelectedPath = $sRoot & StringReplace(_GUICtrlTreeView_GetTree($cTreeView, $hItem), "|", "")
                    ; Check if dummy child exists or has already been filled
                    Local $hFirstChild = _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem)
                    Local $sFirstChild = _GUICtrlTreeView_GetText($hTreeView, $hFirstChild)
                    ; If dummy child exists
                    If $sFirstChild = "" Then
                        ; Fill with content
                        _CFF_Fill_Branch($hTreeView, $cItem, $sSelectedPath, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS)
                        ; Delete the dummy
                        _GUICtrlTreeView_Delete($hTreeView, $hFirstChild)
                    ;Else
                        ; Either already filled or empty
                    EndIf
                    ; Clear the flag to reactivate the handler
                    GUICtrlSendToDummy($cCFF_Expand_Dummy, 0)
                EndIf

            Case $hDrive_Combo
                If GUICtrlRead($hDrive_Combo) <> $sCurrDrive Then
                    ; Get drive chosen
                    $sCurrDrive = GUICtrlRead($hDrive_Combo)
                    If $sRoot Then
                        ; Delete current content
                        _GUICtrlTreeView_DeleteAll($hTreeView)
                    Else
                        ; Show TV
                        GUICtrlSetState($cTreeView, 16) ; $GUI_SHOW
                    EndIf
                    ; Set root path
                    $sRoot = $sCurrDrive & ""
                    ; Fill TV
                    _CFF_Fill_Branch($hTreeView, $cTreeView, $sRoot, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS)
                EndIf

        EndSwitch

    WEnd

EndFunc   ;==>_CFF_Choose

; #FUNCTION# =========================================================================================================
; Name...........: _CFF_Embed
; Description ...: Creates the folder tree within an existing treeview
; Syntax.........: _CFF_Embed ($cTreeView, $sRoot[, $sFile_Mask = "*"[, $iDisplay = 0[, $cReturn = 9999[, $cList = 0]]])
; Parameters ....: $cTreeView   - ControlID of TreeView to use
;                  $sRoot       - Path tree to display
;                  $sFile_Mask  - File name & ext or folder name to match (default = * - match all)
;                  $iDisplay    - Determine what is displayed
;                                 0   - Entire folder tree and all matching files within folders
;                                 1   - All matching files within the specified folder - subfolders are not displayed
;                                 2   - Entire folder tree only - no files.  Doubleclicks will expand, not select, item
;                                 3   - As 2 but doubleclicks will select, not expand, item
;                                 +4  - Do not display Hidden files/folders
;                                 +8  - Do not display System files/folders
;                                 +16 - Hide file extensions (only valid if file mask specifies a single extension)
;                  $cReturn     - ControlID of control to end multipler selection - multiple selection if specified
;                  $cList       - [Optional] List to fill with multiple selections
; Requirement(s).: v3.3 +
; Return values .: Success: Single selection = String containing selected item
;                           Multi selection  = String of selected items delimited by "|"
;                  Failure: Returns "" and sets @error as follows:
;                           1 = Invalid TreeView ControlID
;                           2 = Path does not exist
;                           3 = Invalid $iDisplay parameter
;                           4 = Invalid $cList ControlID
;                           5 = Invalid or missing $cReturn ControlID
;                           6 = Empty tree
; Author ........: Melba23
; Modified ......:
; Remarks .......: - If files are displayed, only files can be selected
;                  - Press ESC to cancel selection
; Example........: Yes
;=====================================================================================================================
Func _CFF_Embed($cTreeView, $sRoot, $sFile_Mask = "*", $iDisplay = 0, $cReturn = 9999, $cList = 0)

    If Not IsHWnd(GUICtrlGetHandle($cTreeView)) Then
        Return SetError(1, 0, "")
    Else
        $hTreeView = GUICtrlGetHandle($cTreeView)
    EndIf

    If Not FileExists($sRoot) Then
        Return SetError(2, 0, "")
    EndIf
    If StringRight($sRoot, 1) <> "" Then
        $sRoot &= ""
    EndIf

    ; Check FileMask
    If $sFile_Mask = Default Then
        $sFile_Mask = "*"
    EndIf

    ; Check Display
    ; Hide file extensions?
    Local $fShow_Ext = True
    If BitAnd($iDisplay, 16) Then
        $iDisplay -= 16
        ; Check that only one ext is specified
        StringReplace($sFile_Mask, ";", "")
        Local $iExt = @extended
        If StringRight($sFile_Mask, 1) <> "*" And $iExt = 0 Then
            ; File exts hidden
            $fShow_Ext = False
        EndIf
    EndIf
    ; Show hiden and system files
    Local $iHide_HS = 0
    If BitAnd($iDisplay, 4) Then
        $iHide_HS += 4
        $iDisplay -= 4
    EndIf
    If BitAnd($iDisplay, 8) Then
        $iHide_HS += 8
        $iDisplay -= 8
    EndIf
    ; Check valid parameter
    Switch $iDisplay
        Case 0 To 3
            ; Valid
        Case Else
            Return SetError(3, 0, "")
    EndSwitch

    ; Check return control
    Local $sAddFile_List = ""
    Local $fSingle_Sel = True
    Switch $cReturn
        Case 9999
            ; Single select
        Case Else
            ; Check if valid ControlID
            If Not IsHWnd(GUICtrlGetHandle($cReturn)) Then
                Return SetError(4, 0, "")
            Else
                ; Multi select
                $fSingle_Sel = False
            EndIf
    EndSwitch

    ; If list passed check if valid ControlID
    If $cList And Not IsHWnd(GUICtrlGetHandle($cList)) Then
        Return SetError(5, 0, "")
    EndIf

    ; Create dummy control to fire when [+] clicked
    $cCFF_Expand_Dummy = GUICtrlCreateDummy()
    ; Create dummy control to for on DblClk
    $cCFF_DblClk_Dummy = GUICtrlCreateDummy()

    ;ConsoleWrite("Params: " & @CRLF & $hTreeView & @CRLF & $cTreeView & @CRLF & $sRoot & @CRLF & $iDisplay & @CRLF & $sFile_Mask & @CRLF & $fShow_Ext & @CRLF & $iHide_HS & @CRLF)

    ; Fill treeview
    If Not _CFF_Fill_Branch($hTreeView, $cTreeView, $sRoot, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS) Then
        Return SetError(6, 0, "")
    EndIf

    ; Open DLL
    $hDLL = "user32.dll"

    ; Change to MessageLoop mode
    Local $nOldOpt = Opt('GUIOnEventMode', 0)

    While 1

        Switch GUIGetMsg()
            Case $cReturn
                ; Clear treeview and list
                _GUICtrlTreeView_DeleteAll($cTreeView)
                GUICtrlSetData($cList, "|")
                ; Closee DLL
                DllClose($hDLL)
                ; Restore previous mode
                Opt('GUIOnEventMode', $nOldOpt)
                ; Return list of files selected
                Return $sAddFile_List

            Case $cCFF_DblClk_Dummy
                ; Check doubleclicks are permitted (not default for folders only)
                If $iDisplay <> 2 Then
                    ; Get item data
                    Local $cItem = GUICtrlRead($cTreeView)
                    Local $hItem = GUICtrlGetHandle($cItem)
                    ; Determine item path
                    $sSelectedPath = $sRoot & StringReplace(_GUICtrlTreeView_GetTree($hTreeView, $hItem), "|", "")
                    ; Check path is a valid selection
                    Switch $iDisplay
                        Case 2
                            ; Folders only
                        Case Else
                            ; Files only
                            StringReplace(FileGetAttrib($sSelectedPath), "D", "")
                            ; Is it a folder?
                            If @extended Then
                                $sSelectedPath = ""
                            EndIf
                            ; Hide extension?
                            If $fShow_Ext = False Then
                                $sSelectedPath &= StringTrimLeft($sFile_Mask, 1)
                            EndIf
                    EndSwitch
                    If $sSelectedPath Then
                        ; Valid item selected
                        If $fSingle_Sel Then
                            ; Clear treeview
                            _GUICtrlTreeView_DeleteAll($cTreeView)
                            ; Closee DLL
                            DllClose($hDLL)
                            ; Restore previous mode
                            Opt('GUIOnEventMode', $nOldOpt)
                            ; Return valid path
                            Return $sSelectedPath
                        Else
                            ; Add to return string
                            $sAddFile_List &= $sSelectedPath & "|"
                            ; Add to onscreen list
                            GUICtrlSendMsg($cList, 0x0180, 0, $sSelectedPath) ; $LB_ADDSTRING
                            ; Scroll to bottom of list
                            GUICtrlSendMsg($cList, 0x197, GUICtrlSendMsg($cList, 0x18B, 0, 0) - 1, 0) ; $LB_SETTOPINDEX, $LB_GETCOUNT
                            ; Return focus to TV
                            GUICtrlSetState($cTreeView, 256) ; $GUI_FOCUS
                        EndIf
                    EndIf
                EndIf

            Case $cCFF_Expand_Dummy
                ; Get expanded item hamdle
                $hItem = GUICtrlRead($cCFF_Expand_Dummy)
                If $hItem Then
                    ; Select item
                    _GUICtrlTreeView_ClickItem($hTreeView, $hItem)
                    ; Get expanded item data
                    $cItem = GUICtrlRead($cTreeView)
                    $hItem = GUICtrlGetHandle($cItem)
                    $sSelectedPath = $sRoot & StringReplace(_GUICtrlTreeView_GetTree($cTreeView, $hItem), "|", "")
                    ; Check if dummy child exists or has already been filled
                    Local $hFirstChild = _GUICtrlTreeView_GetFirstChild($hTreeView, $hItem)
                    Local $sFirstChild = _GUICtrlTreeView_GetText($hTreeView, $hFirstChild)
                    ; If dummy child exists
                    If $sFirstChild = "" Then
                        ; Fill with content
                        _CFF_Fill_Branch($hTreeView, $cItem, $sSelectedPath, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS)
                        ; Delete the dummy
                        _GUICtrlTreeView_Delete($hTreeView, $hFirstChild)
                    ;Else
                        ; Either already filled or empty
                    EndIf
                    ; Clear the flag to reactivate the handler
                    GUICtrlSendToDummy($cCFF_Expand_Dummy, 0)
                EndIf
        EndSwitch

        ; Look for ESC key to cancel
        Local $aDLL_Ret = DllCall($hDLL, "short", "GetAsyncKeyState", "int", '0x1B')
        If IsArray($aDLL_Ret) And BitAND($aDLL_Ret[0], 0x8000) Then
            ; Clear treeview
            _GUICtrlTreeView_DeleteAll($cTreeView)
            ; Closee DLL
            DllClose($hDLL)
            ; Restore previous mode
            Opt('GUIOnEventMode', $nOldOpt)
            ; Return
            Return SetError(7, 0, "")
        EndIf

    WEnd

EndFunc

; #FUNCTION# =========================================================================================================
; Name...........: _CFF_RegMsg
; Description ...: Registers WM_NOTIFY to action doubleclick and item expansion on TreeView
; Syntax.........: _CFF_RegMsg()
; Parameteres....: None
; Requirement(s).: v3.3 +
; Return values .: Success: 1
;                  Failure: 0
; Author ........: Melba23
; Modified ......:
; Remarks .......: If the script already has a WM_NOTIFY handler then call the _CFF_WM_NOTIFY_Handler function
;                  from within it
; Example........: Yes
;=====================================================================================================================
Func _CFF_RegMsg()

    Return GUIRegisterMsg(0x004E, "_CFF_WM_NOTIFY_Handler") ; $WM_NOTIFY

EndFunc   ;==>_CFF_RegMsg

; #FUNCTION# =========================================================================================================
; Name...........: _CFF_WM_NOTIFY_Handler
; Description ...: Windows message handler for WM_NOTIFY - reacts to doubleclick and item expansion on TreeView
; Syntax.........: _CFF_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)
; Requirement(s).: v3.3 +
; Return values..: None
; Author ........: Melba23 - thanks to guinness for help with the #*@#*%# Struct !!!!
; Modified ......:
; Remarks .......: If a WM_NOTIFY handler already registered, then call this function from within that handler
; Example........: Yes
;=====================================================================================================================
Func _CFF_WM_NOTIFY_Handler($hWnd, $iMsg, $wParam, $lParam)

    #forceref $hWnd, $iMsg, $wParam

    Local $tStruct = DllStructCreate("struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct;" & _
        "uint Action;struct;uint OldMask;handle OldhItem;uint OldState;uint OldStateMask;" & _
        "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;lparam OldParam;endstruct;" & _
        "struct;uint NewMask;handle NewhItem;uint NewState;uint NewStateMask;" & _
        "ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;lparam NewParam;endstruct;" & _
        "struct;long PointX;long PointY;endstruct", $lParam)
    Local $hItem = DllStructGetData($tStruct, 'NewhItem')
    Local $ID = DllStructGetData($tStruct, 'Code')
    Switch $ID
        Case 0xFFFFFFFD ; $NM_DBLCLK
            ; Fire the dummy control
            GUICtrlSendToDummy($cCFF_DblClk_Dummy)
        Case $TVN_ITEMEXPANDEDW, $TVN_ITEMEXPANDEDA
            ; Check that expansion is not ongoing
            If GUICtrlRead($cCFF_Expand_Dummy) = 0 Then
                ; Fire the dummy control
                GUICtrlSendToDummy($cCFF_Expand_Dummy, $hItem)
            EndIf
    EndSwitch

EndFunc   ;==>_CFF_WM_NOTIFY_Handler

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: _CFF_Combo_Fill
; Description ...: Creates and fills a combo to allow drive selection.
; Author ........: Melba23
; Remarks .......:
; ===============================================================================================================================
Func _CFF_Combo_Fill($iW)

    Local $iInset = Int(($iW - 170) / 2)

    GUICtrlCreateLabel("Select Drive:", 10 + $iInset, 15, 65, 20)
    Local $hCombo = GUICtrlCreateCombo("", 75 + $iInset, 10, 50, 20)
    Local $aDrives = DriveGetDrive("ALL")
    For $i = 1 To $aDrives[0]
        ; Only display ready drives
        If DriveStatus($aDrives[$i] & '') <> "NOTREADY" Then GUICtrlSetData($hCombo, StringUpper($aDrives[$i]))
    Next
    Return $hCombo

EndFunc   ;==>_CFF_Combo_Fill

; #INTERNAL_USE_ONLY# ===========================================================================================================
; Name...........: _CFF_Fill_Branch
; Description ...: Fills a TreeView branch with folders and files on expansion
; Author ........: Melba23
; Remarks .......:
; ===============================================================================================================================
Func _CFF_Fill_Branch($hTV, $cParent, $sPath, $iDisplay, $sFile_Mask, $fShow_Ext, $iHide_HS)

    Local $sItem, $cItem, $hSearch, $FFound = False

    If StringRight($sPath, 1) <> "" Then
        $sPath &= ""
    EndIf

    ConsoleWrite("Path: " & $sPath & @CRLF)

    _GUICtrlTreeView_BeginUpdate($hTV)
    Switch $iDisplay
        Case 0, 2, 3
            ; List folders
            Local $aContent = _RecFileListToArray($sPath, "*", 2 + $iHide_HS, 0, 1, 1)

            If IsArray($aContent) Then
                ConsoleWrite("Folders: " & $aContent[0] & @CRLF)
            Else
                ConsoleWrite("No folders found" & @CRLF)
            EndIf

            If IsArray($aContent) Then
                For $i = 1 To $aContent[0]
                    ; Remove trailing  if needed
                    $sItem = $aContent[$i]
                    If StringRight($sItem, 1) = "" Then
                        $sItem = StringTrimRight($sItem, 1)
                    EndIf
                    ; Create item
                    $cItem = GUICtrlCreateTreeViewItem($sItem, $cParent)
                    ; Look for content within the folder
                    FileChangeDir($sPath & $aContent[$i])
                    $hSearch = FileFindFirstFile("*.*")
                    ; If there is something
                    If $hSearch <> -1 Then
                        ; Set flag
                        $FFound = True
                        ; Need to determine type of content?
                        Switch $iDisplay
                            Case 0 ; Either folder or file
                                ; Create dummy child to force [+] display
                                GUICtrlCreateTreeViewItem("", $cItem)
                            Case Else
                                While 1
                                    FileFindNextFile($hSearch)
                                    ; End of content
                                    If @error Then ExitLoop
                                    Local $iExtended = @extended
                                    Switch $iDisplay
                                        Case 1 ; Files only
                                            If Not $iExtended Then
                                                ; Found file
                                                GUICtrlCreateTreeViewItem("", $cItem)
                                                ; No need to look further
                                                ExitLoop
                                            EndIf
                                        Case Else ; Folders only
                                            If $iExtended Then
                                                ; Found folder
                                                GUICtrlCreateTreeViewItem("", $cItem)
                                                ; No need to look further
                                                ExitLoop
                                            EndIf
                                    EndSwitch
                                WEnd
                                ; Close search
                                FileClose($hSearch)
                        EndSwitch
                    EndIf
                    FileChangeDir(@ScriptDir)
                Next
            EndIf
    EndSwitch
    Switch $iDisplay
        Case 0, 1
            ; List files
            $aContent = _RecFileListToArray($sPath, $sFile_Mask, 1 + $iHide_HS, 0, 1)

            If IsArray($aContent) Then
                ConsoleWrite("Files: " & $aContent[0] & @CRLF)
            Else
                ConsoleWrite("No files found" & @CRLF)
            EndIf

            If IsArray($aContent) Then
                ; Set flag
                $FFound = True
                For $i = 1 To $aContent[0]
                    $sItem = $aContent[$i]
                    ; Remove extension if required
                    If Not $fShow_Ext Then
                        $sItem = StringRegExpReplace($sItem, "(.*)..*", "$1")
                    EndIf
                    ; Create item
                    GUICtrlCreateTreeViewItem($sItem, $cParent)
                Next
            EndIf
    EndSwitch
    _GUICtrlTreeView_EndUpdate($hTV)

    Return $fFound

EndFunc   ;==>_CFF_Fill_Branch

I get:

Path: C:
Folders: 11
Files: 7
7 -

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

  • Moderators

Syed,

I am enjoying this testing

Good - because there will be some more! :D

Now we know the problem is happening because the UDF can find no files in your C: drive. :wacko:

But before we look into that, can you please change line 53 in the example file and run it again. The line currently reads:

; No return Control specified, so only single selection
$sSel = _CFF_Embed($cTV_Single, $sRoot, "*.*", 12) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

and you should make it read:

; No return Control specified, so only single selection
$sSel = _CFF_Embed($cTV_Single, $sRoot, "*.*", 0) ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Then run the example again and see if works following that change. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

That makes sence! i got the response from the UDF now which works awesome and got below result.

Path: C:
Folders: 20
Files: 3
Path: C:Users
Folders: 12
Files: 1
Path: C:UsersQ03200
Folders: 24
Files: 9
Path: C:UsersQ03200Desktop
Folders: 4
Files: 11
0 - C:UsersQ03200Desktop1.vbs

To be honest i ready the UDF and tried to find the meaning for value "12" but i was not able to find and play arround with myself. so i just came to the Melba23 :D

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

Have you downloaded the latest version of my RecFileListToArray UDF which I posted on 4 Oct? I think not because that is why the ChooseFileFolder UDF is failing. Please do that now and see if the example works when you reset the example parameter to 12. ;)

Setting the parameter to 12 hides the "Hidden" and "System" files and folder - it was you asked for that functionality and I mentioned that it was available in the second post of this long thread. You cannot blame me if I do what you ask and then you ignore the new file! :P

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

haa... that is where i have done a mistake. when i downloaded ChooseFileFolder.zip i found _RecFileListtoArray.au3 on that and i thought that is having the updated one and i was using it... hummm missed it :mad2:

I am going to Syed23 :wacko2:

Thanks for finding that so quickly melba23!

Edited: Tested after copying _RecFilelisttoArray.au3 and it works! let me imoprt the function in my project and will let you know the test result!

Edited by Syed23

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

The UDF can now cope with UDF-created TreeViews - see the latest post in the CFF thread. ;)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Thanks Melba23! I saw it :) you perfectly shotted on my forehead ;) i will utilize this UDF and function and also i will try to play with this code by importing in to project! Thanks for your patience and help! as always you rock!

Thanks once again!

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

Hi Melba23,

your ChooseFileFolder function is really awesome! By understanding your code i have created a tiny function which will helped me to complete my prject :thumbsup: . Thanks a lot for your help, you always rock Melba23!

Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Link to comment
Share on other sites

  • Moderators

Syed23,

Always happy to help. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...