Modify ↓
#2560 closed Feature Request (Fixed)
UDF - GuiTreeView.au3 - _GUICtrlTreeView_Sort - proposal 2
| Reported by: | mlipok | Owned by: | guinness |
|---|---|---|---|
| Milestone: | 3.3.9.26 | Component: | Standard UDFs |
| Version: | Severity: | None | |
| Keywords: | Cc: |
Description
it is continuation to:
http://www.autoitscript.com/trac/autoit/ticket/2554
now _GUICtrlTreeView_Sort contains:
Func _GUICtrlTreeView_Sort($hWnd) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) Local $iItemCount = _GUICtrlTreeView_GetCount($hWnd) If $iItemCount Then Local $aTreeView[$iItemCount], $hItem = 0 For $i = 0 To $iItemCount - 1 If $i Then $hItem = _SendMessage($hWnd, $TVM_GETNEXTITEM, $TVGN_NEXT, $hItem, 0, "wparam", "handle", "handle") Else $hItem = _SendMessage($hWnd, $TVM_GETNEXTITEM, $TVGN_CHILD, $TVI_ROOT, 0, "wparam", "handle", "handle") EndIf $aTreeView[$i] = $hItem Next Local $hChild = 0, $iRecursive = 1 For $i = 0 To UBound($aTreeView) - 1 _SendMessage($hWnd, $TVM_SORTCHILDREN, $iRecursive, $aTreeView[$i], 0, "wparam", "handle") ; Sort the items in root Do ; Sort all child items $hChild = _SendMessage($hWnd, $TVM_GETNEXTITEM, $TVGN_CHILD, $hItem, 0, "wparam", "handle", "handle") If $hChild Then _SendMessage($hWnd, $TVM_SORTCHILDREN, $iRecursive, $hChild, 0, "wparam", "handle") EndIf $hItem = $hChild Until $hItem = 0x00000000 Next EndIf EndFunc ;==>_GUICtrlTreeView_Sort
why You use:
For $i = 0 To UBound($aTreeView) - 1
IMHO
easier and faster way:
For $i = 0 To $iItemCount - 1
Attachments (0)
Change History (4)
comment:1 by , 12 years ago
| Version: | Other |
|---|
comment:2 by , 12 years ago
You keep saying these are faster, but you offer no benchmarks to show that they are. How much faster is it doing it this way?
comment:3 by , 12 years ago
| Milestone: | → 3.3.9.26 |
|---|---|
| Owner: | set to |
| Resolution: | → Fixed |
| Status: | new → closed |
Fixed by revision [9269] in version: 3.3.9.26
comment:4 by , 12 years ago
I wouldn't say it's faster (not tested) but it's at least smarter as it's one less function call.
Note:
See TracTickets
for help on using tickets.

Automatic ticket cleanup.