Ved prave to je chyba, ktora vznikne pri konverzii, co si mal obalit do bloku try/except. Nemam po ruke Delphi a uz dlho som v nom nerobil, takze skusim iba tak naslepo:
Kód:
var
Form1: TForm1;
implementation
var tm: integer = 0;
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
V:integer;
begin
tm:= tm+1;
try
V:= StrToInt(Edit1.Text);
except
on E:exception do begin
ShowMessage( 'Neplatne cislo!' );
Timer1.Enabled := false;
exit;
end;
end;
Timer1.Intervar := V * 1000;
if tm = 1 then image1.Picture.LoadFromFile('1.bmp');
if tm = (2*V+1) then image1.Picture.loadfromfile('2.bmp');
if tm = (3*V+1) then image1.Picture.loadfromfile('3.bmp');
if tm = (4*V+1) then image1.Picture.loadfromfile('4.bmp');
if tm = (5*V+1) then image1.Picture.loadfromfile('5.bmp');
if tm = (6*V+1) then image1.Picture.loadfromfile('6.bmp');
if tm = (7*V+1) then close;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Timer1.Enabled:=true;
end;
end.
Na zaciatku nastav v Object Inspectore Timer1.Enabled na false, ak nemas. Potom po kliknuti na Button1 sa spusti Timer1. Tie if-y si mozes zmenit na prepinac
case, bolo by to prehladnejsie a tomu prepinaniu obrazkov som trocha nepochopil ako to riesis, takze som ti do toho nic nemenil.