Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Find and Close all Instantiated Forms
Message
From
04/02/2009 16:56:42
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
04/02/2009 16:41:15
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01365406
Message ID:
01379354
Views:
31
>Naomi,
>Is there a way to govern which of these forms are released first? I have instances of modal forms called by other modal forms called by business object forms. Is there a way to see which form was instantiated first? I got the code to work, but I need them to close in the reverse order they were opened.

You may cycle through the _screen.forms collection and make a list of the forms which are candidates for closing, like the modal ones with .datasession=1, or those instantiated by other forms, i.e. with .parent.baseclass="Form". However, this set of rules may not suit your situation. You(r framework) may run your forms in a different manner - your modal forms may have private datasessions, they may be instantiated by some forms manager which would then be the same .parent for all of them, even for the standalone ones etc etc.

If you have a consistent way of calling these modal forms - like having a .oCaller property on each, and whenever any form instantiates another it passes itself as a parameter and reference to it goes into this property, then you can build a quick cursor with level of calling - i.e. if one's oCaller is in the list three levels deep, then it's fourth level itself, and if there's no fifth level form, you can safely kill it.

Did anyone say overkill? :). I guess there must be a simpler way - maybe setting a .nLevel property at the time the modal form .init()s, by simply taking the .parent.nLevel+1? But you'd have to set this property on every form class you use, and make sure every form.init() is dodefault()ed, or else this wouldn't work... not everywhere.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform