unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    NextGrid61: TNextGrid6;
    NxReportGridView61: TNxReportGridView6;
    Button1: TButton;
    NxIconColumn61: TNxIconColumn6;
    PopupMenu1: TPopupMenu;
    Enabled1: TMenuItem;
    Selectable1: TMenuItem;
    NxTextColumn61: TNxTextColumn6;
    NxNumberColumn61: TNxNumberColumn6;
    NxCheckBoxColumn61: TNxCheckBoxColumn6;
    GroupBox1: TGroupBox;
    CheckBox1: TCheckBox;
    Editing1: TMenuItem;
    N1: TMenuItem;
    HideWhenEmpty1: TMenuItem;
    N2: TMenuItem;
    CheckBox2: TCheckBox;
    NxTrackbarColumn61: TNxTrackbarColumn6;
    Interactive1: TMenuItem;
    CheckBox3: TCheckBox;
    CheckBox4: TCheckBox;
    procedure Button1Click(Sender: TObject);
    procedure NxIconColumn61HeaderButtonClick(Sender: TObject; X, Y: Integer;
      var Accept: Boolean);
    procedure Enabled1Click(Sender: TObject);
    procedure Selectable1Click(Sender: TObject);
    procedure NextGrid61Select(Sender: TObject; ACol, ARow: Integer);
    procedure CheckBox1Click(Sender: TObject);
    procedure Editing1Click(Sender: TObject);
    procedure HideWhenEmpty1Click(Sender: TObject);
    procedure CheckBox2Click(Sender: TObject);
    procedure Interactive1Click(Sender: TObject);
    procedure CheckBox3Click(Sender: TObject);
    procedure CheckBox4Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  NextGrid61.AddRow(4);
end;

procedure TForm1.NextGrid61Select(Sender: TObject; ACol, ARow: Integer);
begin
  CheckBox1.Checked := NextGrid61.Cell[ACol, ARow].Enabled;
  CheckBox2.Checked := NextGrid61.Cell[ACol, ARow].Empty;
end;

procedure TForm1.NxIconColumn61HeaderButtonClick(Sender: TObject; X, Y: Integer;
  var Accept: Boolean);
begin
  { Prevent default pop-up to be shown }
  Accept := False;

  with Sender as TNxColumn6 do
  begin

    { If Enabled is False, all cells in col
      are totaly inactive. }
    Enabled1.Checked := Enabled;

    { If Selectable is False, cell is still active,
      but can not be selected. It is ideal for
      Toolbar, TrackBar cols. }
    Selectable1.Checked := Selectable;

    Editing1.Checked := Editing;

    HideWhenEmpty1.Checked := HideWhenEmpty;

    Interactive1.Checked := Interactive;

    { Tag will tell us which col is open after
      user select option in popup. }
    PopupMenu1.Tag := TNxColumn6(Sender).Index;

    PopupMenu1.Popup(X, Y);
  end;
end;

procedure TForm1.CheckBox1Click(Sender: TObject);
begin
  if NextGrid61.SelectedCell <> nil then
  begin
    NextGrid61.SelectedCell.Enabled := CheckBox1.Checked;
  end;
end;

procedure TForm1.CheckBox2Click(Sender: TObject);
begin
  if NextGrid61.SelectedCell <> nil then
  begin
    NextGrid61.SelectedCell.Empty := CheckBox2.Checked;
  end;
end;

procedure TForm1.CheckBox3Click(Sender: TObject);
begin
  case TCheckBox(Sender).Checked of
    True: NextGrid61.Options := NextGrid61.Options + [goAutoHideScrollBars];
    else NextGrid61.Options := NextGrid61.Options - [goAutoHideScrollBars];
  end;
end;

procedure TForm1.CheckBox4Click(Sender: TObject);
begin
  if TCheckBox(Sender).Checked then
    NextGrid61.ScrollBars := [sbVertical]
  else
    NextGrid61.ScrollBars := [];
end;

procedure TForm1.Editing1Click(Sender: TObject);
begin
  NextGrid61.Columns[PopupMenu1.Tag].Editing := TMenuItem(Sender).Checked;
end;

procedure TForm1.Enabled1Click(Sender: TObject);
begin
  NextGrid61.Columns[PopupMenu1.Tag].Enabled := TMenuItem(Sender).Checked;
end;

procedure TForm1.HideWhenEmpty1Click(Sender: TObject);
begin
  NextGrid61.Columns[PopupMenu1.Tag].HideWhenEmpty := TMenuItem(Sender).Checked;
end;

procedure TForm1.Interactive1Click(Sender: TObject);
begin
  NextGrid61.Columns[PopupMenu1.Tag].Interactive := TMenuItem(Sender).Checked;
end;

procedure TForm1.Selectable1Click(Sender: TObject);
begin
  NextGrid61.Columns[PopupMenu1.Tag].Selectable := TMenuItem(Sender).Checked;
end;

end.
