Opened 6 years ago

Closed 6 years ago

#3585 closed Bug (Fixed)

pb _GUICtrlTreeView_Sort not sorting level 1 treeview -- With Solution

Reported by: gilles@… Owned by: Jpm
Milestone: Component: AutoIt
Version: Severity: None
Keywords: GUICtrlTreeView_Sort Cc:


with deep tree, _GUICtrlTreeView_Sort does not sort it.

Proposed solution : for detail see post


; #FUNCTION# ====================================================================================================================
; Author ........: Gary Frost (gafrost)
; Modified.......: mlipok, guinness, gillesg
; Ths time optimized ===============================================================================================================================
Func _GUICtrlTreeView_Sort3($hWnd)
    If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)

    Local $iItemCount = _GUICtrlTreeView_GetCount($hWnd)
    If $iItemCount Then
        Local $aTreeView[$iItemCount], $i=0
        ; get only A child at each level
        Local $hHandle = _GUICtrlTreeView_GetFirstItem($hWnd)
        __GUICtrlTreeView_SortGetFirstChild($hWnd, $hHandle, $aTreeView )
        redim $aTreeView[$aTreeView[0]]

        for $i =0 to UBound($aTreeView) -1
            _SendMessage($hWnd, $TVM_SORTCHILDREN, 0, $aTreeView[$i], 0, "wparam", "handle") ; Sort the items in root

EndFunc   ;==>_GUICtrlTreeView_Sort3

func __GUICtrlTreeView_SortGetFirstChild($hWnd, $hItem, byref $aTreeView)
    Local $hChild = _GUICtrlTreeView_GetFirstChild($hWnd, $hItem)
    if $hChild <> 0 then
        $aTreeView[$aTreeView[0] ]= $hChild
    local $hNext = _GUICtrlTreeView_GetNextSibling($hWnd, $hItem)
    if $hNext <> 0 then __GUICtrlTreeView_SortGetFirstChild($hWnd,$hnext,$aTreeView)


Hope it help

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by Jpm

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

Fixed by revision [11958] 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 Jpm.

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

Note: See TracTickets for help on using tickets.