unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Grids, StdCtrls, ComCtrls, Menus;
type
TForm1 =
class(TForm)
Panel1: TPanel;
Panel2: TPanel;
Name: TLabeledEdit;
Alter: TLabeledEdit;
Wohnort: TLabeledEdit;
Tel: TLabeledEdit;
HinzuBtn: TButton;
LoeschenBtn: TButton;
AdresseGrid: TStringGrid;
BeendenBtn: TButton;
MonthCalendar1: TMonthCalendar;
Panel3: TPanel;
MainMenu1: TMainMenu;
Datei1: TMenuItem;
Speichern1: TMenuItem;
Speichernunter1: TMenuItem;
Nochnichtfertig1: TMenuItem;
Schlieen1: TMenuItem;
procedure BeendenBtnClick(Sender: TObject);
procedure HinzuBtnClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure LoeschenBtnClick(Sender: TObject);
procedure Schlieen1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
Name, Wohnort:
string;
Alter, Tel: integer;
implementation
{$R *.dfm}
procedure TForm1.BeendenBtnClick(Sender: TObject);
begin
//sleep(1000);
close;
end;
procedure TForm1.HinzuBtnClick(Sender: TObject);
var i : integer;
begin
for i := 0
to AdresseGrid.RowCount-1
do // Name
begin
if AdresseGrid.Cells[1, i] = '
'
then
begin
AdresseGrid.Cells[1, i] :=
Name.Text;
break;
end;
end;
begin
for i := 0
to AdresseGrid.RowCount-1
do
begin
if AdresseGrid.Cells[2, i] = '
'
then // Alter
begin
AdresseGrid.Cells[2, i] := Alter.Text;
break;
end;
end;
begin
for i := 0
to AdresseGrid.RowCount-1
do
begin
if AdresseGrid.Cells[3, i] = '
'
then
begin // Wohnort
AdresseGrid.Cells[3, i] := Wohnort.Text;
break;
end;
end;
begin
for i := 0
to AdresseGrid.RowCount-1
do
begin
if AdresseGrid.Cells[4, i] = '
'
then // Tel. Nummer
begin
AdresseGrid.Cells[4, i] := Tel.Text;
break;
end;
end;
end;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var i : integer;
begin
AdresseGrid.Refresh;
AdresseGrid.ColWidths[0] := 25;
AdresseGrid.Cells[1,0]:= '
Name';
AdresseGrid.Cells[2,0]:= '
Alter';
AdresseGrid.Cells[3,0]:= '
Wohnort';
AdresseGrid.Cells[4,0]:= '
Telefon';
for i := 1
to 20
do
begin
AdresseGrid.Cells[0,i]:= IntToStr(i);
end;
end;
procedure TForm1.LoeschenBtnClick(Sender: TObject);
begin
Name.Clear;
Alter.Clear;
Wohnort.Clear;
Tel.Clear;
end;
procedure TForm1.Schlieen1Click(Sender: TObject);
begin
close;
end;
end.