unit Kaiserreich;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ComCtrls,IniFiles, StdCtrls, ExtCtrls, Grids, ValEdit, dbcgrids,
TabNotBk, OleServer, Access2000, Buttons;
type
TMuenzen=
record
Jahr:
string[4];
praegung:
array [1..9,1..2]
of byte;
end;
TForm2 =
class(TForm)
PageControl1: TPageControl;
TabSheet1: TTabSheet;
TabSheet2: TTabSheet;
TabSheet3: TTabSheet;
TabSheet4: TTabSheet;
TabSheet5: TTabSheet;
TabSheet6: TTabSheet;
TabSheet8: TTabSheet;
TabSheet9: TTabSheet;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
ComboBox1: TComboBox;
Button2: TButton;
A: TCheckBox;
B: TCheckBox;
C: TCheckBox;
D: TCheckBox;
E: TCheckBox;
F: TCheckBox;
G: TCheckBox;
H: TCheckBox;
J: TCheckBox;
TabSheet7: TTabSheet;
Label11: TLabel;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
Label42: TLabel;
Label43: TLabel;
Label44: TLabel;
Label45: TLabel;
Label46: TLabel;
Label47: TLabel;
Label48: TLabel;
Label49: TLabel;
Label50: TLabel;
Label51: TLabel;
Label52: TLabel;
Label53: TLabel;
Label54: TLabel;
Label55: TLabel;
Label56: TLabel;
Label57: TLabel;
Label58: TLabel;
Label59: TLabel;
Label60: TLabel;
Label61: TLabel;
Label62: TLabel;
Label63: TLabel;
Label64: TLabel;
Label65: TLabel;
Label66: TLabel;
Label67: TLabel;
Label68: TLabel;
Label69: TLabel;
Label70: TLabel;
Label71: TLabel;
Label72: TLabel;
Label73: TLabel;
Label74: TLabel;
Label75: TLabel;
Label76: TLabel;
Label77: TLabel;
Label78: TLabel;
Label79: TLabel;
Label80: TLabel;
Label81: TLabel;
Label82: TLabel;
Label83: TLabel;
Label84: TLabel;
Label85: TLabel;
Label86: TLabel;
Label87: TLabel;
Label88: TLabel;
Label89: TLabel;
Label90: TLabel;
procedure FormShow(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure PageControl1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
MO1,MO2,MO5,MO10,MO20,MO50,MO100,MO25,MO1_2:
Array [1..37]
of Record
myedit:tedit;
mycheckbox:
array [1..9]
of TCheckBox;
end;
muenze:TMuenzen;
f1,f2,f3,f5,f10,f20,f50,f100,f25,f1_2:
file of TMuenzen;
implementation
{$R *.dfm}
function cedit1(ort:tcomponent; par:twincontrol; jahr:
string; x,y:integer) : TEdit;
begin
Result := TEdit.Create(ort);
Result.Parent := par;
Result.Height := 21;
Result.Width := 33;
Result.Text := jahr;
Result.Left := x;
Result.Top := y;
Result.
ReadOnly:=true;
end;
function ccheckbox(ort:tcomponent; par:twincontrol; hacken:byte; x,y:integer):TCheckBox;
begin
Result := TCheckBox.Create(ort);
Result.Parent := par;
Result.Height := 17;
Result.Width := 25;
Result.Caption := '
';
if hacken=1
then Result.checked :=true
else Result.checked :=false;
Result.Left := x;
Result.Top := y;
end;
procedure pfennig_1;
var i,k:integer;
begin
try
reset(f1);
for i:=1
to filesize(f1)
do
begin
read(f1,muenze);
MO1[i].myedit:=cedit1(Form2.PageControl1.Pages[0], Form2.PageControl1.Pages[0], muenze.jahr, 16,32*i);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
MO1[i].mycheckbox[k]:=ccheckbox(Form2.PageControl1.Pages[0], Form2.PageControl1.Pages[0], muenze.praegung[k,2] , k*25+54,32*i);
end;
end;
reset(f1);
finally
end;
end;
procedure pfennig_2;
var i,k:integer;
begin
try
reset(f2);
for i:=1
to filesize(f2)
do
begin
read(f2,muenze);
MO2[i].myedit:=cedit1(Form2.PageControl1.Pages[1], Form2.PageControl1.Pages[1], muenze.jahr, 16,32*i);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
MO2[i].mycheckbox[k]:=ccheckbox(Form2.PageControl1.Pages[1], Form2.PageControl1.Pages[1], muenze.praegung[k,2] , k*25+54,32*i);
end;
end;
reset(f2);
finally
end;
end;
procedure pfennig_5;
var i,k:integer;
begin
try
reset(f5);
for i:=1
to filesize(f5)
do
begin
read(f5,muenze);
MO5[i].myedit:=cedit1(Form2.PageControl1.Pages[2], Form2.PageControl1.Pages[2], muenze.jahr, 16,32*i);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
MO5[i].mycheckbox[k]:=ccheckbox(Form2.PageControl1.Pages[2], Form2.PageControl1.Pages[2], muenze.praegung[k,2] , k*25+54,32*i);
end;
end;
reset(f5);
finally
end;
end;
procedure pfennig_10;
var i,k:integer;
begin
try
reset(f10);
for i:=1
to filesize(f10)
do
begin
read(f10,muenze);
MO10[i].myedit:=cedit1(Form2.PageControl1.Pages[3], Form2.PageControl1.Pages[3], muenze.jahr, 16,32*i);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
MO10[i].mycheckbox[k]:=ccheckbox(Form2.PageControl1.Pages[3], Form2.PageControl1.Pages[3], muenze.praegung[k,2] , k*25+54,32*i);
end;
end;
reset(f10);
finally
end;
end;
procedure pfennig_20;
var i,k:integer;
begin
try
reset(f20);
for i:=1
to filesize(f20)
do
begin
read(f20,muenze);
MO20[i].myedit:=cedit1(Form2.PageControl1.Pages[4], Form2.PageControl1.Pages[4], muenze.jahr, 16,32*i);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
MO20[i].mycheckbox[k]:=ccheckbox(Form2.PageControl1.Pages[4], Form2.PageControl1.Pages[4], muenze.praegung[k,2] , k*25+54,32*i);
end;
end;
reset(f20);
finally
end;
end;
procedure pfennig_25;
var i,k:integer;
begin
try
reset(f25);
for i:=1
to filesize(f25)
do
begin
read(f25,muenze);
MO25[i].myedit:=cedit1(Form2.PageControl1.Pages[5], Form2.PageControl1.Pages[5], muenze.jahr, 16,32*i);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
MO25[i].mycheckbox[k]:=ccheckbox(Form2.PageControl1.Pages[5], Form2.PageControl1.Pages[5], muenze.praegung[k,2] , k*25+54,32*i);
end;
end;
reset(f25);
finally
end;
end;
procedure pfennig_50;
var i,k:integer;
begin
try
reset(f50);
for i:=1
to filesize(f50)
do
begin
read(f50,muenze);
MO50[i].myedit:=cedit1(Form2.PageControl1.Pages[6], Form2.PageControl1.Pages[6], muenze.jahr, 16,32*i);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
MO50[i].mycheckbox[k]:=ccheckbox(Form2.PageControl1.Pages[6], Form2.PageControl1.Pages[6], muenze.praegung[k,2] , k*25+54,32*i);
end;
end;
reset(f50);
finally
end;
end;
procedure pfennig_1_2;
var i,k:integer;
begin
try
reset(f1_2);
for i:=1
to filesize(f1_2)
do
begin
read(f1_2,muenze);
MO1_2[i].myedit:=cedit1(Form2.PageControl1.Pages[7], Form2.PageControl1.Pages[7], muenze.jahr, 16,32*i);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
MO1_2[i].mycheckbox[k]:=ccheckbox(Form2.PageControl1.Pages[7], Form2.PageControl1.Pages[7], muenze.praegung[k,2] , k*25+54,32*i);
end;
end;
reset(f1_2);
finally
end;
end;
procedure pfennig_100;
var i,k:integer;
begin
try
reset(f100);
for i:=1
to filesize(f100)
do
begin
read(f100,muenze);
MO100[i].myedit:=cedit1(Form2.PageControl1.Pages[8], Form2.PageControl1.Pages[8], muenze.jahr, 16,32*i);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
MO100[i].mycheckbox[k]:=ccheckbox(Form2.PageControl1.Pages[8], Form2.PageControl1.Pages[8], muenze.praegung[k,2] , k*25+54,32*i);
end;
end;
reset(f100);
finally
end;
end;
procedure TForm2.FormShow(Sender: TObject);
begin
pagecontrol1.Pages[0].Show;
// pagecontrol1.TabIndex:=0;
pfennig_1;
pfennig_2;
pfennig_5;
pfennig_10;
pfennig_20;
pfennig_25;
pfennig_50;
pfennig_1_2;
pfennig_100;
Form2.PageControl1.Height:=32*filesize(f1)+128;
end;
procedure TForm2.Button2Click(Sender: TObject);
var i,k:integer;
begin
seek(f3,filesize(f3));
muenze.Jahr:=combobox1.Items.Strings[combobox1.ItemIndex];
muenze.praegung[1,1]:=ord(a.Checked);
muenze.praegung[2,1]:=ord(b.Checked);
muenze.praegung[3,1]:=ord(c.Checked);
muenze.praegung[4,1]:=ord(d.Checked);
muenze.praegung[5,1]:=ord(e.Checked);
muenze.praegung[6,1]:=ord(f.Checked);
muenze.praegung[7,1]:=ord(g.Checked);
muenze.praegung[8,1]:=ord(h.Checked);
muenze.praegung[9,1]:=ord(j.Checked);
write(f3,muenze);
end;
procedure TForm2.FormClose(Sender: TObject;
var Action: TCloseAction);
var i,k:integer;
begin
try
reset(f1);
for i:=1
to filesize(f1)
do
begin
read(f1,muenze);
seek(f1,filepos(f1)-1);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
muenze.praegung[k,2]:=ord(mo1[i].mycheckbox[k].Checked);
end;
write(f1,muenze);
end;
except
application.MessageBox('
Es ist ein Fehler beim speichern der Datei'+#10#13+'
"\...\kaiserreich\1_Pfennig"'+#10#13+'
aufgetreten','
Fehler',mb_ok+mb_iconerror);
end;
try
reset(f2);
for i:=1
to filesize(f2)
do
begin
read(f2,muenze);
seek(f2,filepos(f2)-1);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
muenze.praegung[k,2]:=ord(mo2[i].mycheckbox[k].Checked);
end;
write(f2,muenze);
end;
except
application.MessageBox('
Es ist ein Fehler beim speichern der Datei'+#10#13+'
"\...\kaiserreich\2_Pfennig"'+#10#13+'
aufgetreten','
Fehler',mb_ok+mb_iconerror);
end;
try
reset(f5);
for i:=1
to filesize(f5)
do
begin
read(f5,muenze);
seek(f5,filepos(f5)-1);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
muenze.praegung[k,2]:=ord(mo5[i].mycheckbox[k].Checked);
end;
write(f5,muenze);
end;
except
application.MessageBox('
Es ist ein Fehler beim speichern der Datei'+#10#13+'
"\...\kaiserreich\5_Pfennig"'+#10#13+'
aufgetreten','
Fehler',mb_ok+mb_iconerror);
end;
try
reset(f10);
for i:=1
to filesize(f10)
do
begin
read(f10,muenze);
seek(f10,filepos(f10)-1);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
muenze.praegung[k,2]:=ord(mo10[i].mycheckbox[k].Checked);
end;
write(f10,muenze);
end;
except
application.MessageBox('
Es ist ein Fehler beim speichern der Datei'+#10#13+'
"\...\kaiserreich\10_Pfennig"'+#10#13+'
aufgetreten','
Fehler',mb_ok+mb_iconerror);
end;
try
reset(f20);
for i:=1
to filesize(f20)
do
begin
read(f20,muenze);
seek(f20,filepos(f20)-1);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
muenze.praegung[k,2]:=ord(mo20[i].mycheckbox[k].Checked);
end;
write(f20,muenze);
end;
except
application.MessageBox('
Es ist ein Fehler beim speichern der Datei'+#10#13+'
"\...\kaiserreich\20_Pfennig"'+#10#13+'
aufgetreten','
Fehler',mb_ok+mb_iconerror);
end;
try
reset(f25);
for i:=1
to filesize(f25)
do
begin
read(f25,muenze);
seek(f25,filepos(f25)-1);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
muenze.praegung[k,2]:=ord(mo25[i].mycheckbox[k].Checked);
end;
write(f25,muenze);
end;
except
application.MessageBox('
Es ist ein Fehler beim speichern der Datei'+#10#13+'
"\...\kaiserreich\25_Pfennig"'+#10#13+'
aufgetreten','
Fehler',mb_ok+mb_iconerror);
end;
try
reset(f50);
for i:=1
to filesize(f50)
do
begin
read(f50,muenze);
seek(f50,filepos(f50)-1);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
muenze.praegung[k,2]:=ord(mo50[i].mycheckbox[k].Checked);
end;
write(f50,muenze);
end;
except
application.MessageBox('
Es ist ein Fehler beim speichern der Datei'+#10#13+'
"\...\kaiserreich\50_Pfennig"'+#10#13+'
aufgetreten','
Fehler',mb_ok+mb_iconerror);
end;
try
reset(f1_2);
for i:=1
to filesize(f1_2)
do
begin
read(f1_2,muenze);
seek(f1_2,filepos(f1_2)-1);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
muenze.praegung[k,2]:=ord(mo1_2[i].mycheckbox[k].Checked);
end;
write(f1_2,muenze);
end;
except
application.MessageBox('
Es ist ein Fehler beim speichern der Datei'+#10#13+'
"\...\kaiserreich\1_2_Pfennig"'+#10#13+'
aufgetreten','
Fehler',mb_ok+mb_iconerror);
end;
try
reset(f100);
for i:=1
to filesize(f100)
do
begin
read(f100,muenze);
seek(f100,filepos(f100)-1);
for k:=1
to 9
do
begin
if muenze.praegung[k,1]=1
then
muenze.praegung[k,2]:=ord(mo100[i].mycheckbox[k].Checked);
end;
write(f100,muenze);
end;
except
application.MessageBox('
Es ist ein Fehler beim speichern der Datei'+#10#13+'
"\...\kaiserreich\100_Pfennig"'+#10#13+'
aufgetreten','
Fehler',mb_ok+mb_iconerror);
end;
try
closefile(f1);
closefile(f2);
closefile(f5);
closefile(f10);
closefile(f20);
closefile(f50);
closefile(f100);
closefile(f25);
closefile(f1_2);
closefile(f3);
except
application.MessageBox('
Es ist ein Fehler beim schließen der Dateien aufgetreten','
Fehler',mb_ok+mb_iconerror);
end;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
assignfile(f1,pchar(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\1_pfennig.ini'));
if fileexists(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\1_pfennig.ini')
then reset(f1)
else rewrite(f1);
assignfile(f2,pchar(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\2_pfennig.ini'));
if fileexists(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\2_pfennig.ini')
then reset(f2)
else rewrite(f2);
assignfile(f5,pchar(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\5_pfennig.ini'));
if fileexists(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\5_pfennig.ini')
then reset(f5)
else rewrite(f5);
assignfile(f10,pchar(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\10_pfennig.ini'));
if fileexists(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\10_pfennig.ini')
then reset(f10)
else rewrite(f10);
assignfile(f20,pchar(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\20_pfennig.ini'));
if fileexists(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\20_pfennig.ini')
then reset(f20)
else rewrite(f20);
assignfile(f50,pchar(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\50_pfennig.ini'));
if fileexists(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\50_pfennig.ini')
then reset(f50)
else rewrite(f50);
assignfile(f100,pchar(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\100_pfennig.ini'));
if fileexists(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\100_pfennig.ini')
then reset(f100)
else rewrite(f100);
assignfile(f25,pchar(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\25_pfennig.ini'));
if fileexists(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\25_pfennig.ini')
then reset(f25)
else rewrite(f25);
assignfile(f1_2,pchar(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\1_2_pfennig.ini'));
if fileexists(ExtractFilePath(Application.ExeName)+'
data\kaiserreich\1_2_pfennig.ini')
then reset(f1_2)
else rewrite(f1_2);
assignfile(f3,pchar(ExtractFilePath(Application.ExeName)+'
data\temp_pfennig.ini'));
if fileexists(ExtractFilePath(Application.ExeName)+'
data\temp_pfennig.ini')
then reset(f3)
else rewrite(f3);
end;
procedure TForm2.PageControl1Change(Sender: TObject);
begin
case pagecontrol1.TabIndex
of
0:Form2.PageControl1.Height:=32*filesize(f1)+128;
1:Form2.PageControl1.Height:=32*filesize(f2)+128;
2:Form2.PageControl1.Height:=32*filesize(f5)+128;
3:Form2.PageControl1.Height:=32*filesize(f10)+128;
4:Form2.PageControl1.Height:=32*filesize(f20)+128;
5:Form2.PageControl1.Height:=32*filesize(f25)+128;
6:Form2.PageControl1.Height:=32*filesize(f50)+128;
7:Form2.PageControl1.Height:=32*filesize(f1_2)+128;
8:Form2.PageControl1.Height:=32*filesize(f100)+128;
end;
end;
end.