Setting modal result is supposed to close the form but I tried close after
setting the modal result but to no affect.  The problem is that the event
doesn't fire if the application to which the form belongs is not active.

JohnB

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Arjang Assadi
Sent: 07 April 2012 23:27
To: Moderated List for the Discussion of Delphi Programming excluding
Database-related topics
Subject: Re: How to close modal form when focus moved to another application

What was the obvious?
after
ModalResult := mrCancel;
do you have the line
Close;
?
On 7 April 2012 00:34, John Barrat <[email protected]> wrote:

> On the OnDeactivate event of the modal form, do a ModalResult := 
> mrCancel;
>
> I had already tried the obvious - it doesn't work
>
> JohnB
> -----Original Message-----
> From: [email protected] [mailto:[email protected]] On 
> Behalf Of Chee Meng Wong
> Sent: 05 April 2012 09:24
> To: Moderated List for the Discussion of Delphi Programming excluding 
> Database-related topics
> Subject: Re: How to close modal form when focus moved to another 
> application
>
>
> On Apr 4, 2012, at 9:48 PM, John Barrat wrote:
>
> > I have an application which needs to close a modal form if focus is 
> > moved to another application.
> >
> > Effectively, I want to be able to use moving away and to another 
> > application to effect a cancel on the modal form.
> >
> > The problem is that by the time the deactivate event has occurred 
> > the parent application to which the form is modal is now inactive.  
> > Can anyone suggest a way around this?
> >
> >
> >
> > JohnB
> >
> > _______________________________________________
> > Delphi mailing list
> > [email protected]
> > http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
> >
>
> _______________________________________________
> Delphi mailing list
> [email protected]
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
> _______________________________________________
> Delphi mailing list
> [email protected]
> http://lists.elists.org/cgi-bin/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list
[email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
[email protected]
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to