unit uTestStringGridWithControls;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Grids,
  StdCtrls, ExtCtrls, uStringGridWithControls;

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Panel1: TPanel;
    StringGrid1: TStringGrid;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure StringGrid1ColRowMoved(Sender: TObject; IsColumn: Boolean;
      sIndex, tIndex: Integer);
  private
    { private declarations }
  public
    { public declarations }
    sg: TStringGridWithControls;
  end;

var
  Form1: TForm1;

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.Button1Click(Sender: TObject);
var
  i,j: Integer;
  col, newCol, oldCol: TGridColumn;
  str: TStringList;
begin

  str:=TStringList.Create;
  str.Add('Federico');
  sg.InsertRow(str);
  sg.AutoSizeColumns;

end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  sg.AutoSizeColumns;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  sg:= TStringGridWithControls.Create(self, Panel1, 'GrillaTest');

  sg.AddTextColumn('TextCol', nil, taCenter, clDefault, nil, taLeftJustify,
    clDefault, false );

  sg.AddBitBtnsColumn('ButtonsCol', nil, taRightJustify, clDefault,
    [BT_Lupa, BT_Lapiz, BT_Upload, BT_Download],
    ['lupita', 'lapiz']);

  sg.AddCheckBoxColumn('CheckBoxCol', nil, taLeftJustify, clDefault, 'test');

end;

procedure TForm1.StringGrid1ColRowMoved(Sender: TObject; IsColumn: Boolean;
  sIndex, tIndex: Integer);
begin

end;

end.

