FlexCel Studio for VCL/LCL
ContentsIndex
PreviousUpNext
TFlxMemTable.OnGetData Event

Occurs each time the dataset needs a value in virtual mode.

Pascal
property OnGetData: TFlxMemTableOnGetDataEvent;
C++
__property TFlxMemTableOnGetDataEvent OnGetData;

In Virtual mode, FlxMemTable will call this event every time it needs a value, as it will not keep any value in memory. 

Assign this event along with OnVirtualRecordCount to enter virtual mode.

This example will create a virtual FlxMemTable containing 2 columns and 5 records. 

Column 1 will be named "Number" and will have the values 0;1;2;3;4 

Column 2 will be named "Value" and will have the values 0;3;6;9;12 

 

We need to drop a TFlxMemTable on a form, double-click it, define the columns "Number" and "Value" and set the events: 

 

procedure TForm1.FlxMemTable1VirtualRecordCount(Sender: TObject;
var RecordCount: Integer);
begin
  RecordCount:=5;
end;
 
procedure TForm1.FlxMemTable1GetData(Sender: TObject;
const FieldName: String; const RecordPos: Integer; var Value: Variant);
begin
  if FieldName='Number' then Value:=RecordPos else
  if FieldName='Value' then Value:=RecordPos*3;
end;
Copyright (c) 2002-2008 TMS Software. All rights reserved.
What do you think about this topic? Send feedback!