Easy question : How to let messagDlg respond to cancelclicks on closing form?
Posted on 2003-03-24
This should be an easy one :
In my application I use the messagedlg(...) to ask for user confirmation when they try to close the form (are you sure? Yes/No)
Now when I close the form through the FileMenu (TMainMenu->Exit) the messagedlg responds to the cancelclick.
But when I press the close-cross (in top-right corner) the popu doesn't respond to cancelclicks, and just blatantly closes the entire application.
Is there a big difference, and/or am I forgetting something?
btw, here's the messageDlg part I used :
if MessageDlg('This will close the program',mtConfirmation,mbOk, mbCancel], 0) = mrOk then
Application.Terminate;// The end of the progame.
else ; // Empty statement to let program respond to cancelclick
I think it has to do with the empty statement, is there another way to do this?
Thanks in advance