You are not logged in.
Pages: 1
Hi,
im playing with TDynArray (until now i use TCollection, but i would like use array of record in next project).
Can i iterate the field of a generic TDynArray and edit the value without know the type of my array of record?
Now i do this with TCollection to fill in a grid and to edit value without know the type of tCollectionItem.
Thanks
Offline
AFAIK to use RTTI you need to know its type information.
For any TObject, you have got the type information from its class (which is stored as pointer at offset 0 of the instance).
But for a dynamic array, you just have a pointer to the data (with its length stored before the items), no type information.
Offline
excuse me ab,
i see the code of RecordEquals in synCommons and seems iterate in the field of a record...with a parameter TypeInfo.
but i can pass to my generic procedure the typeinfo of the specific tdynarray.
what do you think?
Offline
thanks ab, im in the way, when i finish post the code for sharing.
another question about TDynArray:
there is a method to shift an element?
thanks
Offline
i would like to exchange position at two element, but without know the type of element...so i can't use an helper variable...
for example when i know the record type, to shift up an element i do:
var myHelperVar: TMyRecordType;
myHelperVar := TmyRecordType(myDynArray.ElemPtr(Pos)^);
myDynArray.Delete(Pos);
myDynArray.Insert(Pos-1, myHelperVar);
there is a way to do without know the record type!?
Offline
Offline
Pages: 1