Have the mainform code set a flag. Have the secondary forms code check that flag before executing.
dave --- On Fri, 1/2/09, Jeremy Grand <jer...@ninprodata.com> wrote: From: Jeremy Grand <jer...@ninprodata.com> Subject: [advanced_delphi] managing multiple forms of mixed types on close To: advanced_delphi@yahoogroups.com Date: Friday, January 2, 2009, 5:54 PM I’ve been wrestling with this issue for a long time, each time I think I have it fixed, it stays that way a little while, then someone figures out another way to blow things up. Here’s the deal: The app has a main form from which another form is shown non-modally. From this 2nd form, yet a 3rd form can be shown, also non-modally. When the main form is closed, there is a bit of code that runs through the open forms and closes them. The 2nd form has a similar bit of code that cleans up any stray 3rd forms. The problem is, if a user closes the main form when the 2nd form and its spawned 3rd form(s) are open, I’m closing the 3rd one(s) twice. Now, I can probably figure out something to work around the problem in this specific case, but I really think my model is faulty. I need a perfected pattern, if you will. Has anyone solved this issue or found a pattern that works? I’ve been experimenting with windows messaging lately, and that really works well for what it does. And it sounds like it might be a good tool here, but I haven’t figured out how to apply it yet. Jeremy