How reuse Teegrid.Data?
Posted: Fri Dec 01, 2017 2:42 pm
I use grid data as: var EventsArray: TArray<tEventData>;
If I change EventsArray data out of Teegid and after make
MainForm.tgrdEvents.Data:= TVirtualData<TArray<tEventData>>.Create(EventsArray);
all was fine. (array length is same).
Only if I make:
Index:= tgrdEvents.Grid.Selected.Row;
ALength:= Length(EventsArray);
Finalize(EventsArray[Index]);
TailElements := ALength - Index;
if TailElements > 0 then
Move(EventsArray[Index + 1], EventsArray[Index], SizeOf(tEventData) * TailElements);
Initialize(EventsArray[ALength - 1]);
SetLength(EventsArray, ALength - 1); // deleting one element fom center array
MainForm.tgrdEvents.Data:= TVirtualData<TArray<tEventData>>.Create(EventsArray); -- gets access violation
and on screen no more data.
How I can reuse data array with different (longer, shooter) data size?
Harry Kalma.
Erply.
If I change EventsArray data out of Teegid and after make
MainForm.tgrdEvents.Data:= TVirtualData<TArray<tEventData>>.Create(EventsArray);
all was fine. (array length is same).
Only if I make:
Index:= tgrdEvents.Grid.Selected.Row;
ALength:= Length(EventsArray);
Finalize(EventsArray[Index]);
TailElements := ALength - Index;
if TailElements > 0 then
Move(EventsArray[Index + 1], EventsArray[Index], SizeOf(tEventData) * TailElements);
Initialize(EventsArray[ALength - 1]);
SetLength(EventsArray, ALength - 1); // deleting one element fom center array
MainForm.tgrdEvents.Data:= TVirtualData<TArray<tEventData>>.Create(EventsArray); -- gets access violation
and on screen no more data.
How I can reuse data array with different (longer, shooter) data size?
Harry Kalma.
Erply.