Display Caption for several seconds and quit lazarus / 13-General ---------------------------------------------------------------------- MalabarFlash · 2018-06-09 13:12 When the user clicks on the "QUIT" button, I would like the app to display a caption for several seconds and quit the application.  Here is the procedure I used. Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.ButtonQuitClick(Sender: TObject);  LabelBye.Caption := 'Goodbye  Benjamin';  Sysutils.sleep(2000);  Application.Terminate;end; Swapping the "sleep" and "label" instructions has the same output.  I've tried "wait" and "delay" with the same results. What do I need to change to get the caption to display for more than a few milliseconds before termination? ---------------------------------------------------------------------- Handoko · 2018-06-09 13:30 You need to call Application.ProcessMessages: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.ButtonQuitClick(Sender: TObject);begin  LabelBye.Caption := 'Goodbye  Benjamin';  Application.ProcessMessages;  Sysutils.sleep(2000);  Application.Terminate;end; ---------------------------------------------------------------------- MalabarFlash · 2018-06-09 13:52 Thank you Handoko.  That solved my problem.