Indy + timer

0

Mam na formie aktywnego klienta TCP z pakietu Indy. Mam też Timer'a, a w nim:

procedure TForm1.Timer1Timer(Sender: TObject);
begin
klient.SendCmd('serwer');
if klient.LastCmdResult.TextCode = '200' then
begin
if klient.LastCmdResult.Text.Text = 'b1' then begin
  b1.Visible:=false;
  image2.Visible:=true;
end;
if klient.LastCmdResult.Text.Text = 'b2' then begin
  b2.Visible:=false;
  image4.Visible:=true;
end;
if klient.LastCmdResult.Text.Text = 'b3' then begin
  b3.Visible:=false;
  image6.Visible:=true;
end;
if klient.LastCmdResult.Text.Text = 'b4' then begin
  b4.Visible:=false;
  image8.Visible:=true;
end;
if klient.LastCmdResult.Text.Text = 'b5' then begin
  b5.Visible:=false;
  image10.Visible:=true;
end;
if klient.LastCmdResult.Text.Text = 'b6' then begin
  b6.Visible:=false;
  image12.Visible:=true;
end;
if klient.LastCmdResult.Text.Text = 'b7' then begin
  b7.Visible:=false;
  image14.Visible:=true;
end;
if klient.LastCmdResult.Text.Text = 'b8' then begin
  b8.Visible:=false;
  image16.Visible:=true;
end;
if klient.LastCmdResult.Text.Text = 'b9' then begin
  b9.Visible:=false;
  image18.Visible:=true;
end;
timer1.Enabled:=false;
end;
end;

Jednak kiedy Timer.enabled zmieniam na true (po starcie programu jest false), to wtedy forma nie reaguje na nic. Krótko pisząc -> program zawiesza się. Interval jest nastawiony na 1000, a więc to nie wina zbyt małej częstotliwości. Dlaczego tak się dzieje? Co zrobić, żeby program się nie zawieszał? Dodam jeszcze że przy wysyłaniu komendy do serwera jest wszystko ok.

0

dorzuć Tidantifreeze

1 użytkowników online, w tym zalogowanych: 0, gości: 1