home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Best of German Only 1
/
romside_best_of_german_only_1.iso
/
wissen
/
dos
/
wgraph
/
entpack.exe
/
WGDEMOQ!.EXE
/
GMINIDB.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1992-12-19
|
2KB
|
110 lines
{$A+,B-,D-,E-,F+,I-,L-,N-,O+,R-,S-,V-}
UNIT GMiniDB;
INTERFACE
uses GDecl,
GDrivers,
GEvent,
GViews,
GDlg,
Graph;
const cmSaveData = 21;
cmLeft = 22;
cmRight = 23;
type PAdressWindow=^TAdressWindow;
TAdressWindow=object(TDlgWindow)
PosIndex:word;
constructor Init(var Bounds:TRect;ATitle:str80;AType:byte;DInput:boolean);
destructor Done; virtual;
procedure HandleEvent; virtual;
end;
tAdressData=record
Schalter : string[9];
Firma : string[40];
Ort : string[25];
Strasse : string[30];
Telefon : string[20];
end;
var Adresse:tAdressData;
Dat : file of tAdressData;
IMPLEMENTATION
{Implementation TAdressWindow}
constructor TAdressWindow.Init(var Bounds:TRect;ATitle:str80;AType:byte;DInput:boolean);
begin
TDlgWindow.Init(Bounds,ATitle,AType);
PosIndex:=0;
assign(Dat,'ADRESS.DAT');
reset(Dat);
if not DInput then
begin
read(Dat,Adresse);
SetData(Adresse);
end;
end;
destructor TAdressWindow.Done;
begin
TDlgWindow.Done;
close(Dat);
end;
procedure TAdressWindow.HandleEvent;
var k:word;
procedure DeleteDataRecord;
begin
with Adresse do
begin
FillChar(Firma,SizeOf(Firma),' ');
FillChar(Ort,SizeOf(Ort),' ');
FillChar(Strasse,SizeOf(Strasse),' ');
FillChar(Telefon,SizeOf(Telefon),' ');
end;
end;
procedure ReadDataRecord;
begin
seek(Dat,PosIndex);
read(Dat,Adresse);
SetData(Adresse);
DrawMask;
Event.Command:=cmNothing;
end;
begin
TDlgWindow.HandleEvent;
if Event.Command=cmSaveData then
begin
write(Dat,Adresse);
DeleteDataRecord;
SetData(Adresse);
DrawMask;
Event.Command:=cmNothing;
Exit;
end;
if Event.Command=cmRight then
if FilePos(Dat)<FileSize(Dat) then
begin
inc(PosIndex);
ReadDataRecord;
Exit;
end;
if Event.Command=cmLeft then
if PosIndex>0 then
begin
dec(PosIndex);
ReadDataRecord;
Exit;
end;
end;
END.