Recent

Author Topic: How to create a button exit for app  (Read 28837 times)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: How to create a button exit for app
« Reply #15 on: February 28, 2021, 05:29:08 pm »
In fact it does terminate if I wait long enough (long enough being about 10 seconds). Not really the user experience one would want though and I'd missed it because I had not been waiting that long.

That's indeed quite a lot of time nowadays, more so if when you exit normally (by calling the mainform's Close or through the "normal" means) it doesn't happen. I know next to nothing about Macs so I can't help much more, sorry.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

dseligo

  • Hero Member
  • *****
  • Posts: 1196
Re: How to create a button exit for app
« Reply #16 on: March 01, 2021, 10:10:50 am »
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormClose(Sender: TObject; var CloseAction: TCloseAction);
  2. begin
  3.   NSLog(NSStr('leaving...'));
  4.   Application.BringToFront; // needed
  5. //  Button1.Click;
  6. end;
You shouldn't have Button1.Click in FormClose if you have Form1.Close in Button1Click. FormClose is called after Form1.Close.

 

TinyPortal © 2005-2018