Page 1 of 1

SortALLTreeviewItemsbyNameAscending

Posted: Sat Dec 17, 2005 11:50 am
by Psychophanta
Code updated For 5.20+

Code: Select all

Procedure SortALLTreeviewItemsbyNameAscending(TVGadget)
  For t=0 To CountGadgetItems(TVGadget)-1
    If SendMessage_(GadgetID(TVGadget),#TVM_GETNEXTITEM,#TVGN_CHILD,GadgetItemID(TVGadget,t));<-if it is a parent:
      SendMessage_(GadgetID(TVGadget),#TVM_SORTCHILDREN,0,GadgetItemID(TVGadget,t));<-sort all these childs
    EndIf
  Next
  SendMessage_(GadgetID(TVGadget),#TVM_SORTCHILDREN,0,0);<-sort those without parent
EndProcedure
I can't understand why it is so fast. :!:
I've tried it with more than 200000 items; parents, childs, and parents of parents, and it sorts ipsofact :shock:

Posted: Sun Dec 18, 2005 1:42 am
by zikitrake
*kisses*!!!!