Opened 15 years ago

Closed 15 years ago

#495 closed Bug (Fixed)

_GUICtrlTreeView_GetTree returns only 1 parent

Reported by: anonymous Owned by: Gary
Milestone: Component: Standard UDFs
Version: Severity: None
Keywords: Cc:


_GUICtrlTreeView_GetTree sould return the whole treeview-structure for an item, but it returns just the first parent: PARENT|ITEM
This happen, because the line

Until $hItem <> 0x00000000

should be

Until $hItem = 0x00000000

The corrected function:

; #FUNCTION# ====================================================================================================================
; Name...........: _GUICtrlTreeView_GetTree
; Description ...: Retrieve all items text
; Syntax.........: _GUICtrlTreeView_GetTree($hWnd, $hItem)
; Parameters ....: $hWnd  - Handle to the control
;                  $hItem - item ID/handle
; Return values .: Success      - Tree Path of Item
;                  Failure      - Empty string
; Author ........: Gary Frost (gafrost), Holger Kotsch
; Modified.......: Gary Frost (gafrost)
; Remarks .......: Use Opt("GUIDataSeparatorChar", param) to change the separator char used
;                  If $hItem is 0 then an attempt to use current selected is used
; Related .......:
; Link ..........;
; Example .......; Yes
; ===============================================================================================================================
Func _GUICtrlTreeView_GetTree($hWnd, $hItem = 0)
    If $Debug_TV Then _GUICtrlTreeView_ValidateClassName($hWnd)
    If $hItem = 0 Then
        $hItem = 0x00000000
        If Not IsHWnd($hItem) Then $hItem = _GUICtrlTreeView_GetItemHandle($hWnd, $hItem)
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
    Local $szPath = "", $hParent, $sSeparator = Opt("GUIDataSeparatorChar")

    If $hItem = 0x00000000 Then $hItem = _SendMessage($hWnd, $TVM_GETNEXTITEM, $TVGN_CARET, 0, 0, "wparam", "hwnd", "hwnd")
    If $hItem <> 0x00000000 Then
        $szPath = _GUICtrlTreeView_GetText($hWnd, $hItem)
        Do; Get now the parent item handle if there is one
            $hParent = _SendMessage($hWnd, $TVM_GETNEXTITEM, $TVGN_PARENT, $hItem, 0, "wparam", "hwnd", "hwnd")
            If $hParent <> 0x00000000 Then $szPath = _GUICtrlTreeView_GetText($hWnd, $hParent) & $sSeparator & $szPath
            $hItem = $hParent
        Until $hItem = 0x00000000
    Return $szPath
EndFunc   ;==>_GUICtrlTreeView_GetTree

Attachments (0)

Change History (3)

comment:1 Changed 15 years ago by Prog@…

Forgot to change name ...

comment:2 Changed 15 years ago by TicketCleanup

  • Milestone deleted
  • Severity changed from Blocking to None

Automatic ticket cleanup.

comment:3 Changed 15 years ago by Gary

  • Milestone set to
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed in version:

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as closed The owner will remain Gary.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.