unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, ImgList, StdCtrls, NxColumnClasses, NxColumns,
  NxScrollControl, NxCustomGridControl, NxCustomGrid, NxGrid, ExtCtrls,
  NxEdit;

type
  TForm1 = class(TForm)
    NextGrid1: TNextGrid;
    ImageList1: TImageList;
    ProgressColumn1: TNxProgressColumn;
    ImageColumn1: TNxImageColumn;
    TextualColumn1: TNxTextColumn;
    Button1: TButton;
    DateColumn1: TNxDateColumn;
    ImageList2: TImageList;
    Timer1: TTimer;
    Button2: TButton;
    ComboBoxColumn1: TNxListColumn;
    procedure NextGrid1InputAccept(Sender: TObject; var Accept: Boolean);
    procedure NextGrid1CellFormating(Sender: TObject; ACol, ARow: Integer;
      var TextColor: TColor; var FontStyle: TFontStyles;
      CellState: TCellState);
    procedure Button1Click(Sender: TObject);
    procedure NextGrid1SelectCell(Sender: TObject; ACol, ARow: Integer);
    procedure Timer1Timer(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.NextGrid1InputAccept(Sender: TObject;
  var Accept: Boolean);
begin
  ProgressColumn1.InputValue := IntToStr(Random(100));
end;

procedure TForm1.NextGrid1CellFormating(Sender: TObject; ACol,
  ARow: Integer; var TextColor: TColor; var FontStyle: TFontStyles;
  CellState: TCellState);
begin
  if NextGrid1.CellByName['ProgressColumn1', ARow].AsInteger = 100 then begin
    TextColor := clGrayText;
    FontStyle := FontStyle + [fsStrikeOut];
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if NextGrid1.RowCount = 0 then Exit;
  NextGrid1.CellByName['ProgressColumn1', 'Selected'].AsInteger := 100;
  NextGrid1.RefreshRow(NextGrid1.SelectedRow);
end;

procedure TForm1.NextGrid1SelectCell(Sender: TObject; ACol, ARow: Integer);
begin
  Timer1.Enabled := True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  if NextGrid1.RowExist(NextGrid1.SelectedRow) then
  begin
    NextGrid1.Cell[0, NextGrid1.SelectedRow].AsInteger := 1;
    Timer1.Enabled := False;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  with NextGrid1 do
  begin
    AddRow;
    Cell[0, RowCount - 1].AsInteger := 0;
    Cell[1, RowCount - 1].AsString := 'Low';
    Cell[2, RowCount - 1].AsString := 'This is sample task';
  end;
end;

end.
