What is the process for detecting sorting of a Listbox is complete?
The factory sort supplied by XOJO works, but I can’t tell it’s complete in the event.
I would like to have some code at the end of Listbox.SortColumn.
I read adding a timer by code would work and fire after the sort is complete, but it doesn’t seem to work.
This is the code for a timer in Listbox.Sortcolumn
So I followed instructions and put the above in the SortColumn event, and added the method “SortedColumn”, and I’m not sure it worked.
I have for the rowtag the row number.
After the timer fires (it can’t go to the next line until it has finished), a method called CpyRwTgtoArray
whose code is
Dim i As Integer
Redim SrtdArray(-1)
If AdCardList.ListCount-1 <> ArUbnd Then MsgBox"Serious Error"
For i = 0 To AdCardList.ListCount-1
SrtdArray.Append AdCardList.RowTag(i)
Next
//SrtdArray is integer array. AdCardList is the Listbox.
Return
The SrtdArray should have a jumble of numbers but it doesn’t.
Should the next method after the timer produce a jumble of numbers?
Other question. Do I ever call the method Listbox.Sort ???
I have a solution for you, no Timer needed. In a nutshell, I subclassed Listbox and implemented the SortColumn and CellBackgroundPaint events. The former raises the event and, if false, sets a flag then returns false. The latter checks the flag and, if true, raises an AfterSort event. The trick here is that CellBackgroundPaint will fire after sorting is complete so it’s a natural place to raise that event.
I created a sample project that you can find here: