Paul
If ModalResult is set to anything other than 0 it will close the form so
you could make your own type
TFormResult = (frNone, frButton1....)
and set this 'modal result' on the click event of your button
you'd have to cast back to check it
if TFormResult(Form.ModalResult) = frButton1 then....
HTH
Neven
----- Original Message -----
From: "Paul Mckenzie" <[EMAIL PROTECTED]>
To: "Multiple recipients of list delphi" <[EMAIL PROTECTED]>
Sent: Wednesday, June 25, 2003 12:51 PM
Subject: [DUG]: Re-Post Modal FormClose
I don't know what happened to the original post - I have never seen it ...
I have a Modal Form that I want to identify, in the OnClose or OnCloseQuery
events, if the user Closed the form (Top-Right X) or clicked a Button
causing the close (OK or Cancel - with their respective ModalResults). Both
ways of Closing the Form call the Close events and have a ModalResult
(mrCancel for Button Cancel and Top-Right X).
Is their an easy way to identify which caused the close.
I can have a Form variable to do it (I don't like Form variable for this
sort of thing).
I could set both buttons to use mrOK (but one button is cancel)
Any suggestions appreciated.
Regards
Paul McKenzie
Analyst Programmer
SMSS Ltd.
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/