unit DynGrid;

interface

uses
  Classes, SysUtils, IWAppForm, IWApplication, IWTypes, IWWebGrid,
  IWDBAdvWebGrid, DB, DBTables, IWCompListbox, IWCompButton, Controls,
  IWBaseControl, IWControl, IWCompLabel, LeftFrame, Forms, TopFrame,
  IWVCLBaseControl, IWBaseHTMLControl, ADODB;

type
  TformDynGrid = class(TIWAppForm)
    IWLabel1: TIWLabel;
    IWLabel2: TIWLabel;
    IWButton1: TIWButton;
    IWButton2: TIWButton;
    IWButton3: TIWButton;
    IWListbox1: TIWListbox;
    TIWDBAdvWebGrid1: TTIWDBAdvWebGrid;
    FrameTopFrame1: TFrameTopFrame;
    FrameLeftFrame1: TFrameLeftFrame;
    ADOConnection1: TADOConnection;
    ADOQuery1: TADOQuery;
    DataSource1: TDataSource;
    procedure IWButton1Click(Sender: TObject);
    procedure IWButton2Click(Sender: TObject);
    procedure IWButton3Click(Sender: TObject);
    procedure TIWDBAdvWebGrid1GetCellHint(Sender: TObject; RowIndex,
      ColumnIndex: Integer; var AValue: String);
    procedure IWAppFormCreate(Sender: TObject);
  public
  end;

implementation

{$R *.dfm}

uses
  ServerController;


procedure TformDynGrid.IWButton1Click(Sender: TObject);
var
  i: Integer;
begin
   iwlistbox1.Items.Clear;
   for i := 1 to TIWDBAdvWebGrid1.RowTot do
   begin
     if (TIWDBAdvWebGrid1.DynEdits[3,i-1] <> '0') then
       iwlistbox1.Items.Add('Article '+inttostr(i)+' : ' + TIWDBAdvWebGrid1.DynEdits[3,i-1]);
   end;
end;

procedure TformDynGrid.IWButton2Click(Sender: TObject);
begin
  iwlistbox1.Items.Clear;
  TIWDBAdvWebGrid1.ClearDynEdits;
end;

procedure TformDynGrid.IWButton3Click(Sender: TObject);
begin
  iwlistbox1.Items.Clear;
  TIWDBAdvWebGrid1.ClearDynEdits;
  TIWDBAdvWebGrid1.DynEdits[3,2] := '2';
  TIWDBAdvWebGrid1.DynEdits[3,4] := '4';
  TIWDBAdvWebGrid1.DynEdits[3,6] := '6';
end;

procedure TformDynGrid.TIWDBAdvWebGrid1GetCellHint(Sender: TObject; RowIndex,
  ColumnIndex: Integer; var AValue: String);
begin
  if columnindex = 4 then
  AValue := 'Hint for column 4 specified here';
end;

procedure TformDynGrid.IWAppFormCreate(Sender: TObject);
begin
   DecimalSeparator := '.';
   ThousandSeparator := ',';

  ADOConnection1.ConnectionString :=
    'Provider=Microsoft.Jet.OLEDB.4.0;Password="";Persist Security Info=True;Data Source= ' +
  WebApplication.ApplicationPath + 'demos.mdb';
  DataSource1.DataSet.Active := true;
end;

initialization
  TformDynGrid.SetAsMainForm;



end.
