Hi John,

I believe windows does not notify the active window when its application lost 
focus. So OnDeactivate event of your modal form won't be fired.

I think the work around is handling OnDeactivate on application level (i.e. 
through TApplicationEvents). Then find topmost form of your application and 
trigger its OnDeactivate event.

Note that while I believe this will work, but not tested.


Regards,
Luthfi

--- On Fri, 4/6/12, John Barrat <j.bar...@netcom.co.uk> wrote:

> From: John Barrat <j.bar...@netcom.co.uk>
> Subject: RE: How to close modal form when focus moved to another application
> To: "'Moderated List for the Discussion of Delphi Programming excluding 
> Database-related topics'" <delphi@elists.org>
> Date: Friday, April 6, 2012, 9:34 PM
> On the OnDeactivate event of the
> modal form, do a ModalResult := mrCancel; 
> 
> I had already tried the obvious - it doesn't work
> 
> JohnB

_______________________________________________
Delphi mailing list
Delphi@elists.org
http://lists.elists.org/cgi-bin/mailman/listinfo/delphi

Reply via email to