Thus I discovered Structures and SortStructuredArray which are very new to me!
The various examples work well. However I cannot seem to be able to 'convert' them correctly for use within a procedure. Neither have I found a clear-cut example of this. Perhaps someone can point me in the right direction or correct the following code. I think that the problem lies with the ??????????? bit in that I cannot work out how to identify the structure as an array, correctly.
In the following the structure consists of textual or numeric values with iPOINT indicating the list line. Loading and sorting is based on the column predefined in iCOL. All variables have been globally pre-declared.
Code: Select all
Structure HOLDER
aTEXT.s
fVALUE.f
iPOINT.i
EndStructure
Dim HOLDERS.HOLDER(1000) ;Array for sorting by name or value (up to 1000 list lines)
Procedure SORTALL(Array ???????????) ;Load/sort by column number in iCOL
X = CountGadgetItems(#Listview_0) ;Trap length of exiting list
For iINDEX = 0 To X - 1 ;Grab required items To array
Select iCOL
Case 1
HOLDERS(1)\aTEXT = "Here it is." ;Test line!!
HOLDERS(1)\iPOINT = 123 ;Test line!!
; HOLDERS(0)\aTEXT = Trim(aNAME)
; HOLDERS(0)\iPOINT = iINDEX
Case 2
HOLDERS(iINDEX)\fVALUE = fPRICE : HOLDERS(iINDEX)\iPOINT = iINDEX
;------------ and so on with a sort taking place after the array load
EndProcedure
..... and later in program body:-
SORTALL(HOLDERS)



