unit Grid;
{PUBDIST}

interface

uses
  IWAppForm, IWApplication, IWTypes, Classes, Controls, IWControl,
  IWWebGrid, IWAdvWebGrid, IWCompButton, IWCompListbox, SysUtils,
  IWCompLabel, ImgList, IWBaseControl, LeftFrame, Forms, TopFrame,
  IWVCLBaseControl, IWBaseHTMLControl;

type
  TformGrid = class(TIWAppForm)
    TIWAdvWebGrid1: TTIWAdvWebGrid;
    IWButton1: TIWButton;
    IWButton2: TIWButton;
    IWButton3: TIWButton;
    IWButton4: TIWButton;
    IWButton5: TIWButton;                                     
    IWButton6: TIWButton;                         
    IWButton7: TIWButton;
    IWButton8: TIWButton;
    IWListbox1: TIWListbox;
    IWLabel1: TIWLabel;
    FrameTopFrame1: TFrameTopFrame;                  
    FrameLeftFrame1: TFrameLeftFrame;
    IWLabel2: TIWLabel;
    procedure IWButton1Click(Sender: TObject);
    procedure IWButton2Click(Sender: TObject);
    procedure IWButton3Click(Sender: TObject);
    procedure IWButton4Click(Sender: TObject);
    procedure IWButton5Click(Sender: TObject);
    procedure IWButton6Click(Sender: TObject);
    procedure IWButton7Click(Sender: TObject);
    procedure IWButton8Click(Sender: TObject);
    procedure TIWAdvWebGrid1ImageClick(Sender: TObject; RowIndex,
      ColumnIndex: Integer);
    procedure TIWAdvWebGrid1GetCellDetail(Sender: TObject; RowIndex,
      ColumnIndex: Integer; var AValue: String);
    procedure TIWAdvWebGrid1CheckClick(Sender: TObject; RowIndex,
      ColumnIndex: Integer);
  public
  end;

implementation
{$R *.dfm}

uses
  ServerController;

procedure TformGrid.IWButton1Click(Sender: TObject);
begin
   tiwadvwebgrid1.ActiveRow := 15;
end;

procedure TformGrid.IWButton2Click(Sender: TObject);
begin
  tiwadvwebgrid1.Cells[4,0] := 'Bruno';
  tiwadvwebgrid1.Cells[5,0] := 'Fierens';
  tiwadvwebgrid1.Cells[6,0] := 'www.tmssoftware.com';

  tiwadvwebgrid1.Cells[4,1] := 'Chad';
  tiwadvwebgrid1.Cells[5,1] := 'Hower';
  tiwadvwebgrid1.Cells[6,1] := 'www.atozedsoftware.com';

  tiwadvwebgrid1.Cells[4,2] := 'Dale';
  tiwadvwebgrid1.Cells[5,2] := 'Fuller';
  tiwadvwebgrid1.Cells[6,2] := 'www.borland.com';

  tiwadvwebgrid1.Cells[4,19] := 'Bill';
  tiwadvwebgrid1.Cells[5,19] := 'Gates';
  tiwadvwebgrid1.Cells[6,19] := 'www.microsoft.com';

  tiwadvwebgrid1.Cells[7,0] := 'false';
  tiwadvwebgrid1.Cells[7,1] := 'true';
  tiwadvwebgrid1.Cells[7,2] := 'false';

end;

procedure TformGrid.IWButton3Click(Sender: TObject);
begin
  tiwadvwebgrid1.Edit;
end;

procedure TformGrid.IWButton4Click(Sender: TObject);
begin
  tiwadvwebgrid1.Post;
end;

procedure TformGrid.IWButton5Click(Sender: TObject);
begin
  tiwadvwebgrid1.Cancel;
end;

procedure TformGrid.IWButton6Click(Sender: TObject);
begin
  TIWAdvWebGrid1.TotalRows := TIWAdvWebGrid1.TotalRows + 1;
end;

procedure TformGrid.IWButton7Click(Sender: TObject);
begin
  TIWAdvWebGrid1.TotalRows := TIWAdvWebGrid1.TotalRows - 1;
end;

procedure TformGrid.IWButton8Click(Sender: TObject);
var
  i: Integer;
begin
  iwlistbox1.Items.Clear;
  for i := 1 to TIWAdvWebGrid1.TotalRows do
  begin
    if TIWAdvWebGrid1.RowSelect[i - 1] then
      iwlistbox1.Items.Add(inttostr(i));
  end;
  {
  TIWAdvWebGrid1.RowSelect[0] := true;
  TIWAdvWebGrid1.RowSelect[3] := true;
  TIWAdvWebGrid1.RowSelect[5] := true;
  }
{
  for i := 1 to TIWAdvWebGrid1.TotalRows do
  begin
    if TIWAdvWebGrid1.Cells[3,i-1] <> '' then
      iwlistbox1.items.Add(IntToStr(i)+':'+TIWAdvWebGrid1.Cells[3,i-1]);
  end;
}
end;

procedure TformGrid.TIWAdvWebGrid1ImageClick(Sender: TObject; RowIndex,
  ColumnIndex: Integer);
begin
  iwlistbox1.Items.Add(inttostr(rowindex)+':'+inttostr(columnindex));
end;

procedure TformGrid.TIWAdvWebGrid1GetCellDetail(Sender: TObject; RowIndex,
  ColumnIndex: Integer; var AValue: String);
begin
 case ColumnIndex of
 0:AValue := '*';
 1:AValue := 'This is row '+IntToStr(RowIndex)+'<BR>and another row';
 end;
end;

procedure TformGrid.TIWAdvWebGrid1CheckClick(Sender: TObject; RowIndex,
  ColumnIndex: Integer);
begin
  iwlistbox1.items.Add(inttostr(columnindex)+':'+inttostr(rowindex));
end;

initialization
  TformGrid.SetAsMainForm;

end.
