YOUSEFUL / DELPHI / COMPONENTS

TAtlasGetCellEvent

Method type of TAtlasVirtualData.OnGetCell: supply one cell.

Type Unit Atlas.VGridData · Product Atlas Virtual Grid

Description

TAtlasGetCellEvent = procedure(Sender: TObject; Column, Row: Integer; var Cell: TAtlasCell) of object; Sender is the TAtlasVirtualData. Cell arrives as a null cell of the column's kind; replace it with the value.

This type has no members of its own beyond those listed in its description.

Examples

Compute cells on demand

The handler is GetCell.

pascal
uses System.Classes, Atlas.VGridData;

type
  TSquares = class(TComponent)
  private
    FData: TAtlasVirtualData;
    procedure GetCell(Sender: TObject; Column, Row: Integer; var Cell: TAtlasCell);
  public
    constructor Create(AOwner: TComponent); override;
    property Data: TAtlasVirtualData read FData;
  end;

constructor TSquares.Create(AOwner: TComponent);
begin
  inherited;
  FData := TAtlasVirtualData.Create(Self);
  FData.AddColumn('N', ckNumber);
  FData.AddColumn('N squared', ckNumber);
  FData.OnGetCell := GetCell;                // asked only for the cells being shown
  FData.RowCount := 1000000;
end;

procedure TSquares.GetCell(Sender: TObject; Column, Row: Integer; var Cell: TAtlasCell);
begin
  if Column = 0 then Cell := TAtlasCell.OfNumber(Row + 1)
  else Cell := TAtlasCell.OfNumber(Sqr(Int64(Row) + 1));
end;

TAtlasVirtualData · TAtlasSetCellEvent · TAtlasCell

Also in Atlas Virtual Grid

TAtlasVirtualGrid · TAtlasMemoryData · TAtlasVirtualData · TAtlasPlotData