SortALLTreeviewItemsbyNameAscending

Share your advanced PureBasic knowledge/code with the community.
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

SortALLTreeviewItemsbyNameAscending

Post 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:
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
zikitrake
Addict
Addict
Posts: 876
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

Post by zikitrake »

*kisses*!!!!
PB 6.21 beta, PureVision User
Post Reply