Recent

Author Topic: Problem with TVirtualStringTree and alphabetical order  (Read 2864 times)

pusuni

  • Jr. Member
  • **
  • Posts: 72
Problem with TVirtualStringTree and alphabetical order
« on: November 05, 2018, 12:05:28 pm »
Hi. I've wrote some code for using VirtualStringTree like a file manager. In the capture one you can see. I've define one order for file positions too: alphabetical order. That's works properly.

https://image.ibb.co/hFjeYL/Sin-t-tulo0.jpg

Now I change  the name of file. For example "Windows 10.txt" to "aWindows 10.txt" (capture two)

https://image.ibb.co/bRyj00/Sin-t-tulo1.jpg

but the new file with the new name is not in the right place. When I move the mouse out of control and i make a click in other control and now I return to the previous control, the orden in the tree changes and the file is put  in the right place (capture three) 

https://image.ibb.co/iNrRDL/Sin-t-tulo2.jpg

How can I do that immediately I press the return key? I've test witn Repaint, Refresh and invalidate but I get negative results. The tree doesn't change. How can I force a repaint of the tree nodes?


Thanks in advanced

balazsszekely

  • Guest
Re: Problem with TVirtualStringTree and alphabetical order
« Reply #1 on: November 05, 2018, 12:57:28 pm »
You should sort the tree when the OnEdited event is called(editing has finished):
Code: Pascal  [Select][+][-]
  1. VirtualStringTree1.SortTree(0, sdAscending);
The above code will sort the first column in ascending order.

pusuni

  • Jr. Member
  • **
  • Posts: 72
Re: Problem with TVirtualStringTree and alphabetical order
« Reply #2 on: November 05, 2018, 01:48:07 pm »
Thanks a lot

That's fixed the issue

 

TinyPortal © 2005-2018