home *** CD-ROM | disk | FTP | other *** search
- unit Testform;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, ExtCtrls, Grids, DBGrids, DB, DBTables, FldInfo;
-
- { SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs;}
-
-
- type
- TForm1 = class(TForm)
- TestTable: TTable;
- DBGrid1: TDBGrid;
- Panel1: TPanel;
- SaveBtn: TButton;
- LoadBtn: TButton;
- OrigBtn: TButton;
- DataSource1: TDataSource;
- QuitBtn: TButton;
- procedure FormActivate(Sender: TObject);
- procedure OrigBtnClick(Sender: TObject);
- procedure SaveBtnClick(Sender: TObject);
- procedure LoadBtnClick(Sender: TObject);
- procedure QuitBtnClick(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.FormActivate(Sender: TObject);
- begin
- {point the database to local dir!}
- TestTable.DataBaseName := ExtractFilePath(Application.ExeName);
- TestTable.TableName := 'TestDB';
- TestTable.Active := True;
- end;
-
- procedure TForm1.OrigBtnClick(Sender: TObject);
- begin
- TestTable.Active := False;
- TestTable.Active := True;
- end;
-
- procedure TForm1.SaveBtnClick(Sender: TObject);
- var
- FileName: string;
- begin
- FileName := ExtractFilePath(Application.ExeName) + 'TestForm.Ini';
- PutFieldInfo(FileName, TestTable);
- end;
-
- procedure TForm1.LoadBtnClick(Sender: TObject);
- var
- FileName: string;
- begin
- FileName := ExtractFilePath(Application.ExeName) + 'TestForm.Ini';
- GetFieldInfo(FileName, TestTable);
- end;
-
- procedure TForm1.QuitBtnClick(Sender: TObject);
- begin
- Close;
- end;
-
- end.
-