unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    NextGrid61: TNextGrid6;
    Button1: TButton;
    NxTreeColumn61: TNxTreeColumn6;
    NxReportGridView61: TNxReportGridView6;
    Button2: TButton;
    NxCheckBoxColumn61: TNxCheckBoxColumn6;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  i, s: Integer;
begin
  s := NextGrid61.ChildRowCount;
  NextGrid61.AddRow(8);
  for i := s to NextGrid61.RowCount - 1 do
  begin
    NextGrid61.Cell[1, i].AsString := 'root ' + IntToStr(i);
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  i, s: Integer;
  ParentRow: INxRow;
begin
  if NextGrid61.RowExists(NextGrid61.SelectedRow) then
  begin
    ParentRow := NextGrid61.Row[NextGrid61.SelectedRow];
    s := ParentRow.ChildRowCount;
    NextGrid61.AddChildRow(ParentRow, 4);
    for i := s to ParentRow.ChildRowCount - 1 do
    begin
      (ParentRow.ChildRow[i] as INxCellsRow).Cells[1].AsString := 'child ' + IntToStr(i);
    end;
  end;
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  NextGrid61.DeleteSelected;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
  NextGrid61.Cell[1, NextGrid61.SelectedRow].Color := clLime;
  NextGrid61.MoveRow(NextGrid61.SelectedRow, 11);
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
  if NextGrid61.IsSelectionValid then NextGrid61.Row[NextGrid61.SelectedRow].Collapse(True);
end;

end.
