unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    NextGrid61: TNextGrid6;
    NxReportGridView61: TNxReportGridView6;
    NxCheckBoxColumn61: TNxCheckBoxColumn6;
    NxTextColumn61: TNxTextColumn6;
    NxNumberColumn61: TNxNumberColumn6;
    Button1: TButton;
    NxTrackbarColumn61: TNxTrackbarColumn6;
    Button3: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure NxTextColumn61SetCell(Sender: TObject; ACol, ARow: Integer; Cell: INxBaseCell);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  // Equal to NextGrid61.Cell[NextGrid61.SelectedCol, NextGrid61.SelectedRow].Hide;
  NextGrid61.SelectedCell.Hide; // or .Visible := False;
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  FontDialog: TFontDialog;
begin
  if NextGrid61.SelectedCell <> nil then
  begin
    FontDialog := TFontDialog.Create(Self);
    if FontDialog.Execute then
    begin
      // Font (TFont) is only created on demand
      NextGrid61.SelectedCell.Font := FontDialog.Font;
    end;
    FontDialog.Free;
  end;
end;

procedure TForm1.Button3Click(Sender: TObject);
var
  ColorDialog: TColorDialog;
begin
  if NextGrid61.SelectedCell <> nil then
  begin
    ColorDialog := TColorDialog.Create(Self);
    if ColorDialog.Execute then
    begin
      NextGrid61.SelectedCell.Color := ColorDialog.Color;
    end;
    ColorDialog.Free;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  NextGrid61.AddCells([
    'True', 'Jim', '60000',
    'False', 'Lisa', '72000',
    'True', 'George', '46000',
    'True', 'Michael', '56000'
  ],
  [NxCheckBoxColumn61.Index, NxTextColumn61.Index, NxNumberColumn61.Index]);
end;

procedure TForm1.NxTextColumn61SetCell(Sender: TObject; ACol, ARow: Integer; Cell: INxBaseCell);
begin
  // Event called moment before cell is used.
  case ACol of

    1:
    begin
      if ARow = 0 then
      begin
        NextGrid61.Columns[ACol].Alignment := taCenter;
      end else
      begin
        NextGrid61.Columns[ACol].Alignment := taLeftJustify;
      end;

    end;
  end;

end;

end.
