Forum > General
Display Caption for several seconds and quit
(1/1)
MalabarFlash:
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 [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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:
You need to call Application.ProcessMessages:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.ButtonQuitClick(Sender: TObject);begin LabelBye.Caption := 'Goodbye Benjamin'; Application.ProcessMessages; Sysutils.sleep(2000); Application.Terminate;end;
MalabarFlash:
Thank you Handoko. That solved my problem.
Navigation
[0] Message Index