Quote: "Nope."
While it's true you can't use DBPro arrays in types, you can create your own. Since the little bit of code that Nathan03 posted used strings in an array, I wrote a little example using strings as well, but the technique can be tweaked to hold any type of data. Here:
`Here's our "array" type
type Array
Items as dword
ItemCount as integer
ItemSize as integer
endtype
`Setup an instance of the type
InstanceA as Array
`We're going to define an "array" with 5 elements, indexed 1 through 5, each capable of storing 20 characters
InstanceA.ItemCount=5
InstanceA.ItemSize=20
InstanceA.Items=make memory(InstanceA.ItemCount*InstanceA.ItemSize)
fill memory InstanceA.Items,0,InstanceA.ItemCount*InstanceA.ItemSize `Clears the "array" (set every byte in it to 0)
`Fill the "array" with something
SetArrayString(InstanceA,1,"Hello")
SetArrayString(InstanceA,2,"World!")
SetArrayString(InstanceA,3,"My name")
SetArrayString(InstanceA,4,"is Kira.")
SetArrayString(InstanceA,5,"Nice to meet you!")
`Let's retrieve everything we just put into the "array"
for a=1 to 5
print GetArrayString(InstanceA,a)
next a
`And now let's empty the "array"
for a=1 to 5
ClearArrayItem(InstanceA,a)
next a
suspend for key
end
function SetArrayString(List as Array,Index,String$)
Address as dword
Address=List.Items+(Index-1)*List.ItemSize
Length=len(String$)
for a=1 to Length
*Address=asc(mid$(String$,a))
inc Address
next a
endfunction
function GetArrayString(List as Array,Index)
Address as dword
Address=List.Items+(Index-1)*List.ItemSize
String$=""
CurrentByte as byte
for a=1 to List.ItemSize
CurrentByte=(*Address)
if CurrentByte=0 then exit
String$=String$+chr$(CurrentByte)
inc Address
next a
endfunction String$
function ClearArrayItem(List as Array,Index)
Address as dword
Address=List.Items+(Index-1)*List.ItemSize
fill memory Address,0,List.ItemSize
endfunction
Since you
can have other UDT fields in UDTs, you can now take this "array" type and put it in your original type like so:
type TListBox
Control as TControl
Items as Array
endtype
It's been a couple of days, so you might have worked around the problem another way, but if not, you could make this work.