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: delphi-boun...@elists.org [mailto:delphi-boun...@elists.org] 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 > Delphi@elists.org > http://lists.elists.org/cgi-bin/mailman/listinfo/delphi > _______________________________________________ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi _______________________________________________ Delphi mailing list Delphi@elists.org http://lists.elists.org/cgi-bin/mailman/listinfo/delphi