Показать сообщение отдельно
  #11  
Старый 03.06.2013, 19:33
bleex bleex вне форума
Прохожий
 
Регистрация: 02.06.2013
Сообщения: 8
Версия Delphi: Delphi 7
Репутация: 10
Счастье

Работает поиск 1 раз.
Если раскомментировать "Timer2.Enabled:= True;" в конце, то ищет бесконечно..

Код:
procedure TForm5.Timer2Timer(Sender: TObject);
var
  a, с: integer;
  s: string;
begin
  Timer2.Enabled:=False;
  с:= 0;
  if find.checked=true then
    begin
      k:= strtoint(edit1.Text);
      for i:= 1 to m do
        begin
          label1.Caption:= inttostr(i);
          lbl1[i].Color:= clYellow;
          application.ProcessMessages;
          Sleep(100);
          if lbl1[i].height=k then
            begin
              lbl1[i].Color:= clGreen;
              lbl2[i].Font.Color:= clGreen;
              с:= с+1;
              s:= inttostr(с);
              application.ProcessMessages;
              Sleep(100);
              if (i=m) and (с>0) then
                begin
                  ShowMessage(s);
                  Timer2.Enabled:=False;
                end;
              if (i=m) and (с=0) then
                begin
                  ShowMessage('Закончено');
                  Timer2.Enabled:=False;
                end;
            end
          else
              lbl1[i].Color:= clRed;
              application.ProcessMessages;
              Sleep(100);
              if (i=m) and (с>0) then
                begin
                  ShowMessage('Закончено');
                   Timer2.Enabled:=False;
                end;
              if (i=m) and (с=0) then
                begin
                  ShowMessage('Таких элементов не найдено');
                  Timer2.Enabled:=False;
                end;
            end;
    end;
   //Timer2.Enabled:=True;
end;
Ответить с цитированием