procedure Delay(ATime:Integer);
{diese Prozedur sorgt für eine Pause, Parameter in Millsekunden,
also Aufruf durch delay(1000) entspricht 1 sec}
var
Start : Integer;
begin
Start:=GetTickCount;
repeat
Application.ProcessMessages;
until GetTickCount-Start > ATime;
end;
procedure TForm7.FormCreate(Sender: TObject);
const p: Array [1..70] of string =
('Hund','Herz','Haus','Kind','Riss','Tank',
'Pferd','grau','Öl','nass','kalt','Kirche',
'Mann','Boss','Ski','neu','kurz','Uhr',
'Schiff','Hand','schief','Ball','Kreis',
'Puppe','Auto','Buch','Turm','schlau',
'reich','tief','Meer','Sand','Baum','weit',
'Stadt','Land','Handy','fit','Licht','Spott',
'Moodle','Maus','Dame','Wind','Würfel','breit',
'Katze','einsam','Traube','Zunge','fair','Brief',
'alt','See','sanft','Dach','Feuer','Gas','Jacke',
'jung','Fisch','lahm','Kraft','Apfel','Bahn','Computer',
'Mauer','nah','Zimmer','grob');
var i: integer;
begin
i:= 0;
randomize;
for i:= 1 to 20 do begin
TLabel(FindComponent('label'+IntToStr(i))).Caption:= p[random(70)+1];
end;
timer1.Enabled:= true;
end;
procedure TForm7.Timer1Timer(Sender: TObject);
begin
edit1.Visible:= true;
button1.Visible:= true;
Label1.Visible:= false;
Label2.Visible:= false;
Label3.Visible:= false;
Label4.Visible:= false;
Label5.Visible:= false;
Label6.Visible:= false;
Label7.Visible:= false;
Label8.Visible:= false;
Label9.Visible:= false;
Label10.Visible:= false;
Label11.Visible:= false;
Label12.Visible:= false;
Label13.Visible:= false;
Label14.Visible:= false;
Label15.Visible:= false;
Label16.Visible:= false;
Label17.Visible:= false;
Label18.Visible:= false;
Label19.Visible:= false;
Label20.Visible:= false;
end;
procedure TForm7.Button1Click(Sender: TObject);
var a: string; i,j: integer;
b: boolean;
begin
a:= edit1.Text;
i := 0;
repeat
b:=false;
i := i+1;
if a = TLabel(FindComponent('label'+IntToStr(i))).Caption then
begin
b:=true;
TLabel(FindComponent('label'+IntToStr(i))).Visible:= true;
i := 20;
end;
until i = 20;
if b then
Richtig.Visible:= true
else
Falsch.Visible:= true;
delay(2000);
Edit1.Text:= ' ';
Richtig.Visible:= false;
Falsch.Visible:= false;
end;
end.