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;