SPECIAL OFFER        Order and save right now!
20% off with the 729824315 dicscount code for Ultimate Pack and any another product for Delphi from Greatis Programming!

⤷ Use ProcessMessages function

ProcessMessages interrupts the execution of an application so that Windows can respond to events.
So, if you will remove Application.ProcessMessages(); string from this example, then you will never see 'Some text' string on caption of the form.

procedure TForm1.Button1Click(Sender: TObject);
begin
  Caption:='Some text';
  Application.ProcessMessages();
  Sleep(3000);
  Caption:='Form1';
end;
More for developers
Databases for Amazon Associates
Amazon Categories
Amazon Nodes