
February 26th, 2013, 08:17 AM
|
|
The Monk that is Fat.
|
|
Join Date: Nov 2003
Location: UK
Posts: 106
  
Time spent in forums: 18 h 45 m 17 sec
Reputation Power: 13
|
|
|
Confirm (or not) TForm Close [lazarus/pascal]
Is there some way to interupt the Close function of a form and pop up a confirmatoin dialog?
When File->Exit is selected from my main form I run a couple of checks to make sure the user has saved any changes they have made in the application. The user is presented with a MessageDLG asking i fthey are sure they want to exit - and the application only closes if they respond mrYes.
That works fine but I'd like to call the same routine when the top right (in Windows) close button is clicked.
I can get the checks and dialog to be called by setting that functoin in the OnClose event for the main TForm, but this does not allow me to cancel the application closing when the user clicks mrNo.
I get the feeling this is either going to be really easy and I'll feel stupid for asking, or it's going to be difficult (for me as a newbie to lazarus and pascal) to implement.
Thanks,
FM
PS I have experience in the past with Borland C++ builder, but am new to the quirks of pascal in lazarus.
|