how are you simulating the "ok" click?
be sure you are setting ModalResult:=mrOK or ModalResult:=mrCancel
depending on the outcome you want to force.
-ns
-----Original Message-----
From: Stephen Bertram <[EMAIL PROTECTED]>
To: Multiple recipients of list delphi <[EMAIL PROTECTED]>
Date: Thursday, December 14, 2000 09:54
Subject: [DUG]: Event handling in a modal form
>I am trying to modify a legacy app which has a modal login form. We now
>want to skip the login if certain conditions are met.
>
>Simple I thought - the FormActivate event can determine whether the
>conditions are met and simulate the user's OK button click to "close" the
>form. (All the application setup code is in the OK button OnClick event
>handler).
>
>This works well except that when the application is open it behaves as if
>the login form is still active and does not allow user focus.
>
>Any ideas on how or when I can fire the button click to avoid this?
>
>
>Stephen Bertram
>---------------------------------------------------------------------------
> 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"
---------------------------------------------------------------------------
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"