unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus, StdCtrls, ComCtrls, ExtCtrls;
type
TForm1 =
class(TForm)
MainMenu1: TMainMenu;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Datei1: TMenuItem;
ffnen1: TMenuItem;
speichern2: TMenuItem;
beenden1: TMenuItem;
Edit1: TEdit;
Label1: TLabel;
Edit2: TEdit;
Label2: TLabel;
Edit3: TEdit;
Label3: TLabel;
Edit4: TEdit;
Label4: TLabel;
Edit5: TEdit;
Label5: TLabel;
Edit6: TEdit;
Label6: TLabel;
ComboBox1: TComboBox;
Label7: TLabel;
Memo1: TMemo;
Label8: TLabel;
StatusBar1: TStatusBar;
Button1: TButton;
Button2: TButton;
procedure beenden1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure speichern2Click(Sender: TObject);
procedure ffnen1Click(Sender: TObject);
private
procedure ArrayinMaske;
procedure MaskeinArray;
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
type tdaten=record
clanname:
string[20];
clankuerzel:
string[6];
homepage:
string[30];
spiel:
string[20];
kontaktname:
string[30];
icq:integer;
msn:
string[30];
kommentar:
string[150];
end;
const max=100;
var p:integer;
daten:tdaten;
datenfeld:
array[1..max]
of tdaten;
datendatei:
file of tdaten;
{$R *.dfm}
procedure TForm1.ArrayinMaske;
begin
daten:=datenfeld[p];
edit1.text:=daten.clanname;
edit2.text:=daten.clankuerzel;
edit6.text:=daten.homepage;
combobox1.text:=daten.spiel;
edit3.text:=daten.kontaktname;
edit4.Text:=inttostr(daten.icq);
edit5.Text:=daten.msn;
memo1.Text:=daten.kommentar;
statusbar1.panels[0].text:='
Position: '+inttostr(p) + '
/' + inttostr(max);
daten:=datenfeld[p];
end;
procedure TForm1.MaskeinArray;
begin
daten.clanname:=edit1.text;
daten.clankuerzel:=edit2.text;
daten.homepage:=edit6.text;
daten.spiel:=combobox1.Text;
daten.kontaktname:=edit3.text;
daten.icq:=strtoint(edit4.text);
daten.msn:=edit5.Text;
daten.kommentar:=memo1.text;
datenfeld[p]:=daten;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
MaskeinArray;
if p<max
then inc(p);
ArrayinMaske;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
MaskeinArray;
if p>1
then dec(p);
ArrayinMaske;
end;
procedure TForm1.ffnen1Click(Sender: TObject);
var zaehler:integer;
begin
maskeinarray;
if opendialog1.execute
then
begin
assignfile(datendatei, opendialog1.filename);
reset(datendatei);
for zaehler:=1
to max
do
begin
read(datendatei,daten);
datenfeld[zaehler]:=daten;
end;
closefile(datendatei)
end;
end;
procedure TForm1.speichern2Click(Sender: TObject);
var zaehler:integer;
begin
MaskeinArray;
if savedialog1.execute
then
begin
assignfile(datendatei,savedialog1.filename);
rewrite(datendatei);
for zaehler:=1
to max
do
begin
daten:=datenfeld[zaehler];
write(datendatei,daten);
end;
closefile(datendatei)
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
p:=1;
end;
procedure TForm1.beenden1Click(Sender: TObject);
begin
close;
end;
end.