title: Strange behaviour of function Sleep() used in repeat until in Delphi
body: <p>I have function which is reaction on button click. When I click on the button it should start repeat and write values form an array and show them in labels on main form. Problem is with function sleep - there is some bug or something, cause when I click on the button it waits quite a long time and then it finaly start the action but very quickly. Let's look at my code. Thx for advices. </p>
  
  <pre><code>procedure TForm1.ButtonMereniClick(Sender: TObject);
  var
    iterator: Integer;
  begin      
    iterator := 1;
    repeat       
      //write some values stored int arrays to labels on form
      LabelTeplota.Caption:='Teplota: '+FloatToStr(poleTeplota[iterator]);
      LabelVlhkost.Caption:='Vlhkost: '+FloatToStr(poleVlhkost[iterator]);
      LabelTlak.Caption:='Atmosférický tlak: '+FloatToStr(poleTlak[iterator]);
      LabelRychlost.Caption:='Rychlost větru: '+FloatToStr(poleRychlost[iterator]);
      LabelRychlost.Caption:='Rychlost větru: '+FloatToStr(poleRychlost[iterator]);
      LabelIterator.Caption:='iterator: '+IntToStr(iterator);
      Sleep(500);//should be 5000 
      Inc(iterator);
    until iterator = 20;
  end;
  </code></pre>