unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FileServer, StdCtrls;
type
TTestRec =
record
Feld1:
String;
Feld2:
String;
Feld3:
String;
end;
type
TForm1 =
class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
btnOk: TButton;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
procedure FormDestroy(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Edit2Change(Sender: TObject);
procedure Edit3Change(Sender: TObject);
procedure btnOkClick(Sender: TObject);
private
{ Private declarations }
FStream: TFileStream;
FFileWriter: TWriter;
FTestFields: TTestRec;
public
{ Public declarations }
procedure CreateWnd;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.btnOkClick(Sender: TObject);
begin
FFileWriter.WriteString(FTestFields.Feld1);
FFileWriter.WriteString(FTestFields.Feld2);
FFileWriter.WriteString(FTestFields.Feld3);
end;
procedure TForm1.CreateWnd;
begin
FStream := TFileStream.Create('
Testfile.def', fmCreate);
FFileWriter := TWriter.Create(FStream,1024);
end;
procedure TForm1.Edit1Change(Sender: TObject);
begin
FTestFields.Feld1 := Edit1.Text;
end;
procedure TForm1.Edit2Change(Sender: TObject);
begin
FTestFields.Feld2 := Edit2.Text;
end;
procedure TForm1.Edit3Change(Sender: TObject);
begin
FTestFields.Feld3 := Edit3.Text;
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
FFileWriter.Free;
end;
end.