Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#2560 closed Feature Request (Fixed)

UDF - GuiTreeView.au3 - _GUICtrlTreeView_Sort - proposal 2

Reported by: mlipok Owned by: guinness
Milestone: Component: Standard UDFs
Version: Severity: None
Keywords: Cc:


it is continuation to:

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")
				$hItem = _SendMessage($hWnd, $TVM_GETNEXTITEM, $TVGN_CHILD, $TVI_ROOT, 0, "wparam", "handle", "handle")
			$aTreeView[$i] = $hItem
		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")
				$hItem = $hChild
			Until $hItem = 0x00000000
EndFunc   ;==>_GUICtrlTreeView_Sort

why You use:

For $i = 0 To UBound($aTreeView) - 1

easier and faster way:

For $i = 0 To $iItemCount - 1

Attachments (0)

Change History (4)

comment:1 Changed 9 years ago by TicketCleanup

  • Version Other deleted

Automatic ticket cleanup.

comment:2 Changed 9 years ago by BrewManNH

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 Changed 9 years ago by guinness

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

Fixed by revision [9269] in version:

comment:4 Changed 9 years ago by guinness

I wouldn't say it's faster (not tested) but it's at least smarter as it's one less function call.

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 guinness.

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

Note: See TracTickets for help on using tickets.