Label caption not displayed correctly

Posted by Dave Barrett on January 06, 2009

First of all I apologise for the simplicity of my question but it involves a problem that I just cannot seem to get past. Although what I am trying to do is complex I can break it down into a very simple bit of code. If I write the following:

Label1.Caption := '1';
Sleep(1000); // 1 second
Label1.Caption := '2';
Label1.Caption := '3';

I expect to see the caption counting up in increments of one second but what it actually does is the label does not change untill the whole process is finished, in this case in 3 seconds the label will display 3, I never see the 1 or 2. How can I get round this please?

Related articles


Follow Ups