I have not used the sort function.
I'm looking at the code of the class.
View attachment 27674
View attachment 27675
View attachment 27676
CreateIntegerList need that ViewIndexInPanel but the AddItemNoChkbox routine does not creates a useful view for this purpose, I think.
Create your own list of indexes "manually" (adding a statement inside the loop).
In addition, in your example, the second parameter should be 0, not Z.
lst.SortItems(lst.CreateIntegerList(2, z, lst.NumberOfItems - 1), z, lst.NumberOfItems - 1, False)
lst.SortItems(lst.CreateIntegerList(2, z, lst.NumberOfItems - 1), 0, lst.NumberOfItems - 1, False)
I repeat, I have never used the sorting