unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    NextGrid61: TNextGrid6;
    NxReportGridView61: TNxReportGridView6;
    NxNumberColumn61: TNxNumberColumn6;
    NxMemo61: TNxMemo6;
    NxTreeColumn61: TNxTreeColumn6;
    NxCheckBoxColumn61: TNxCheckBoxColumn6;
    GroupBox1: TGroupBox;
    Button1: TButton;
    Button2: TButton;
    GroupBox2: TGroupBox;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    NxIconColumn61: TNxIconColumn6;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses
  // Required for TNxDataType
  NxTypes6;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  NextGrid61.Serialize.SaveToXML('Layout.xml', dtLayout);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  if FileExists('Layout.xml') then
  begin
    NextGrid61.Serialize.LoadFromXML('Layout.xml', dtLayout);
    NxMemo61.Text := Clipboard.AsText;
  end
  else ShowMessage('File Layout.xml not exist');
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  NextGrid61.Serialize.SaveToXML('Content.xml', dtContent);
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  if FileExists('Content.xml') then
  begin
    NextGrid61.Serialize.LoadFromXML('Content.xml', dtContent);
  end
  else ShowMessage('File Content.xml not exist');
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  NextGrid61.ClearRows;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  SetCurrentDir(ExtractFileDir(ParamStr(0)));

  Button2.Enabled := FileExists('Layout.xml');
  Button4.Enabled := FileExists('Content.xml');

  RegisterClass(TNxTextColumn6);
  RegisterClass(TNxNumberColumn6);

  NxMemo61.WordWrap := False;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'Mike';
    Cells[2].AsString := '56732';
  end;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'George';
    Cells[2].AsString := '56132';
    Cells[3].AsBoolean := True;
  end;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'John';
    Cells[2].AsString := '65156';
    with AddChildRow do
    begin
      Cells[1].AsString := 'Ann';
      Cells[2].AsString := '77424';
    end;
    with AddChildRow do
    begin
      Cells[1].AsString := 'Peter';
      Cells[2].AsString := '71454';
      Cells[2].Color := $0079F6E9;
      Cells[3].AsBoolean := True;
      with AddChildRow do
      begin
        Cells[1].AsString := 'Lisa';
        Cells[2].AsString := '57135';
        Cells[2].Color := $0046DF9B;
      end;
    end;
  end;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'Larry';
    Cells[2].AsString := '84014';
    Cells[2].Hint := 'Cell.Hint';
    Cells[3].AsBoolean := True;
  end;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'Phil';
    Cells[2].AsString := '61673';
    Cells[2].Color := $00599BEF;
    Cells[2].Enabled := False;
    Cells[2].Hint := 'Cell.Enabled = False';
  end;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'Gerald';
    Cells[2].AsString := '48146';
  end;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'Sandy';
    Cells[2].AsString := '49146';
  end;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'Lucy';
    Cells[2].AsString := '51052';
    Cells[2].Color := $0085E7FE;
  end;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'Jason';
    Cells[2].AsString := '56135';
  end;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'Thomas';
    Cells[2].AsString := '44011';
    with NextGrid61.AddRow do
    begin
      Cells[1].AsString := 'Ricky';
      Cells[2].AsString := '25724';
    end;
  end;
  with NextGrid61.AddRow do
  begin
    Cells[1].AsString := 'Billy';
    Cells[2].AsString := '46146';
    Cells[3].AsBoolean := True;
  end;
end;

end.
