Modify

Opened 18 years ago

Closed 18 years ago

#495 closed Bug (Fixed)

_GUICtrlTreeView_GetTree returns only 1 parent

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

Description

_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
    Else
        If Not IsHWnd($hItem) Then $hItem = _GUICtrlTreeView_GetItemHandle($hWnd, $hItem)
    EndIf
    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
    EndIf
    
    Return $szPath
EndFunc   ;==>_GUICtrlTreeView_GetTree

Attachments (0)

Change History (3)

comment:1 by Prog@…, 18 years ago

Forgot to change name ...

comment:2 by TicketCleanup, 18 years ago

Milestone: 3.2.13.7
Severity: BlockingNone

Automatic ticket cleanup.

comment:3 by Gary, 18 years ago

Milestone: 3.2.13.8
Resolution: Fixed
Status: newclosed

Fixed in version: 3.2.13.8

Modify Ticket

Action
as closed The owner will remain Gary.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.