I was asked why the plugin has no sort class? Well, the answer is simply: Once you have the data somewhere in an array, in a listbox or a database, you have built in sort functions. And once I tried to write a plugin class for sorting, I got two issues: Well first if you split the sort code between plugin and the events you'd need to fill like compare and swap, the sort code in the plugin is basicly empty. And as the plugin needs to call to RB code for this events, we have a little performance problem. It is much faster to do it directly in REALbasic.
So basicly the solution is: If you need code, take the following code and adjust it to your datatype:
Sub QuickSort(list() as integer, lo as integer,hi as integer) #pragma disablebackgroundtasks dim i,j as integer dim x as integer dim y as integer i=lo j=hi x=list((lo+hi)/2) while (i<=j) while list(i)
x j=j-1 wend if i<=j then // swap values y=list(i) list(i)=list(j) list(j)=y i=i+1 j=j-1 end if wend if lo < j then QuickSort list,lo,j end if if i < hi then QuickSort list,i,hi end if End Sub Sub Open() // some test code: dim list(-1) as integer for i as integer = 1 to 10 List.Append rnd*100 next 'for i as integer = 0 to UBound(List) ' Listbox1.AddRow str(List(i)) 'next QuickSort list, 0, UBound(List) for i as integer = 0 to UBound(List) Listbox1.AddRow str(List(i)) next End Sub