Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
[b]procedure[/b] Form1.SetStatus(Value: String);
[b]begin[/b]
lblStatus.Caption:= Value; [navy][i]//Set the label's caption
[/i][/navy] Application.ProcessMessages; [navy][i]//Make sure it's actually displayed before continuing
[/i][/navy][b]end[/b];
[b]procedure[/b] Form1.FormCreate(Sender: TObject);
[b]begin[/b]
Self.Show;
Self.BringToFront;
Application.ProcessMessages;
[navy][i]//Do some other heavy loading, knowing the form is already visible
[/i][/navy] [navy][i]//to the user, such as a progress bar showing the loading status
[/i][/navy][b]end[/b];
[b]procedure[/b] Form1.FormClose(Sender: TObject;
[b]var[/b] Action: TCloseAction);
[b]begin[/b]
Hide;
Application.ProcessMessages;
[b]end[/b];
[b]var[/b]
fExecuting: Bool;
[b]procedure[/b] TForm1.FormCreate(Sender: TObject);
[b]begin[/b]
fExecuting:= False; [navy][i]//Set fExecuting by default to False
[/i][/navy][b]end[/b];
[b]procedure[/b] TForm1.TimerOnTimer(Sender: TObject);
[b]begin[/b]
[b]if[/b] [b]not[/b] fExecuting [b]then[/b] [b]begin[/b] [navy][i]//Check if executing
[/i][/navy] fExecuting:= True; [navy][i]//Set fExecuting to True
[/i][/navy] [b]try[/b]
[navy][i]//Do your heavy work here
[/i][/navy]
[b]finally[/b] [navy][i]//If exception occurs, fExecuting still reverted back to False
[/i][/navy] Application.ProcessMessages;
fExecuting:= False;
[b]end[/b];
[b]end[/b];
[b]end[/b];
[b]var[/b]
fRunning: Integer; [navy][i]//For tracking the number of times procedure is running
[/i][/navy]
[b]procedure[/b] TForm1.FormCreate(Sender: TObject);
[b]begin[/b]
fRunning:= [navy]0[/navy]; [navy][i]//Set fRunning to 0 by default (not yet running)
[/i][/navy] Timer1.Interval:= [navy]1[/navy];
Timer1.Enabled:= True;
[b]end[/b];
[b]procedure[/b] TForm1.Timer1Timer(Sender: TObject);
[b]const[/b]
FN = [navy]'D:\Media\Pictures\GForce\Toxic.bmp'[/navy];
[b]var[/b]
X: Integer;
B: TBitmap;
[b]begin[/b]
fRunning:= fRunning + [navy]1[/navy];
lblStatus.Caption:= IntToStr(fRunning)+[navy]' running at a time'[/navy];
Application.ProcessMessages;
[b]try[/b]
[b]for[/b] X:= [navy]0[/navy] [b]to[/b] [navy]50[/navy] [b]do[/b] [b]begin[/b]
B:= TBitmap.Create;
[b]try[/b]
B.LoadFromFile(FN);
Canvas.StretchDraw(Rect(X,X,Width,Height), B);
Application.ProcessMessages; [navy][i]//Try commenting this out
[/i][/navy] [b]finally[/b]
B.Free;
[b]end[/b];
[b]end[/b];
[b]for[/b] X:= [navy]50[/navy] [b]downto[/b] [navy]0[/navy] [b]do[/b] [b]begin[/b]
B:= TBitmap.Create;
[b]try[/b]
B.LoadFromFile(FN);
Canvas.StretchDraw(Rect(X,X,Width,Height), B);
Application.ProcessMessages; [navy][i]//Try commenting this out
[/i][/navy] [b]finally[/b]
B.Free;
[b]end[/b];
[b]end[/b];
[b]finally[/b]
lblStatus.Caption:= IntToStr(fRunning)+[navy]' running at a time'[/navy];
Application.ProcessMessages;
fRunning:= fRunning - [navy]1[/navy];
[b]end[/b];
[b]end[/b];