unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, NxColumns6, Vcl.StdCtrls, NxGridView6,
  NxControls6, NxCustomGrid6, NxGrid6;

type
  TForm3 = class(TForm)
    Button1: TButton;
    lbCellCount: TLabel;
    grSpeedTest: TNextGrid6;
    NxReportGridView2: TNxReportGridView6;
    Button2: TButton;
    Button3: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form3: TForm3;

implementation

uses
  DateUtils, NxCells6;

{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);
const
  coRowCount = 100000;
var
  i, j: Integer;
  MyRow: TNxCellsRow6;
  D1,D2: TDateTime;
begin
  grSpeedTest.Columns.Add(TNxIncrementColumn6, 'Increment');
  grSpeedTest.Columns.Add(TNxTextColumn6, 'Text');
  grSpeedTest.Columns.Add(TNxNumberColumn6, 'Number');
  grSpeedTest.Columns.Add(TNxCheckBoxColumn6, 'CheckBox');
  grSpeedTest.Columns.Add(TNxIconColumn6, 'Icon');
  grSpeedTest.Columns.Add(TNxComboBoxColumn6, 'ComboBox');
  grSpeedTest.Columns.Add(TNxDateColumn6, 'Date');
  grSpeedTest.Columns.Add(TNxMemoColumn6, 'Memo');
  grSpeedTest.Columns.Add(TNxProgressColumn6, 'Progress');
  grSpeedTest.Columns.Add(TNxTrackbarColumn6, 'TrackBar');

  D1 := now;

  grSpeedTest.BeginUpdate([]);

  grSpeedTest.AddRow(coRowCount);

//  MyRow.Dump;

//  MyRow := nil;

  for i := 0 to Pred(grSpeedTest.RowCount) do
  begin
    grSpeedTest.Cell[1, i].AsString := 'Test';
    grSpeedTest.Cell[2, i].AsInteger := 50;
    grSpeedTest.Cell[3, i].AsBoolean := True;
    grSpeedTest.Cell[4, i].AsInteger := 0;
    grSpeedTest.Cell[5, i].AsString := 'Test';
    grSpeedTest.Cell[6, i].AsDateTime := 0;
    grSpeedTest.Cell[7, i].AsString := 'Test';
    grSpeedTest.Cell[8, i].AsInteger := 50;
    grSpeedTest.Cell[9, i].AsInteger := 50;
  end;

  grSpeedTest.EndUpdate;

  D2 := Now;

  ShowMessage(IntToStr(MilliSecondsBetween(D2, D1)));

  lbCellCount.Caption := 'Cell Count: ' + IntToStr(grSpeedTest.Columns.Count * grSpeedTest.RowCount);
end;

procedure TForm3.Button2Click(Sender: TObject);

var
  D1,D2: TDateTime;
begin
  D1 := Now;
  grSpeedTest.Free;
  D2 := Now;

  ShowMessage(IntToStr(MilliSecondsBetween(D2, D1)));
end;

procedure TForm3.Button3Click(Sender: TObject);
begin
  TNxCellsRow6(grSpeedTest.Row[0]).Dump;
end;

end.
