Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: alan shulman
  Where is alan shulman?
 utica
 New York - United States
 alan shulman
 Tags
Subject: RE: Form closing top level form
Thread ID: 331388 Message ID: 331390 # Views: 52 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Thursday, December 29, 2011 4:40:09 PM         
   


> I have a form set as "In top level form". If I close it by hitting 'X' in the top right, it closes itself and the main form. I want the main form to stay open.
> First, does X call the destroy event?

Yes, the event sequence in that case is form.QueryUnload(), followed by form.Destroy() and form.Unload() (that is if there is no "NoDefault" in your custom code QueryUnload())


> How do I prevent the main form from closing?

Normally a form does not release another form, so you may need to find out what unintentional things are going on in your code - as a wild guess, a form would get released if the current wait state is a "Read Events" and you have a forgotten "Clear Events" somewhere in your code, or if the only or last reference pointing to the object is being released unintentionally, for instance the one and only "name" created via "Linked" keyword in a Do Form command or when the form object was created via New/CreateObject(), or your two forms are belonging to a FormSet and your code runs a ThisformSet.Release() unintentionally, or there is a "Clear All" in an ErrorHandler() procedure, or ... (to be continued)



hth
-Stefan

ENTIRE THREAD

Form closing top level form Posted by alan shulman @ 12/29/2011 4:10:48 PM
RE: Form closing top level form Posted by Stefan Wuebbe @ 12/29/2011 4:40:09 PM
RE: Form closing top level form Posted by alan shulman @ 12/29/2011 5:06:40 PM
RE: Form closing top level form Posted by Stefan Wuebbe @ 12/30/2011 9:17:02 AM
RE: Form closing top level form Posted by alan shulman @ 12/30/2011 6:02:51 PM
RE: Form closing top level form Posted by Stefan Wuebbe @ 12/30/2011 7:08:18 PM
RE: Form closing top level form Posted by alan shulman @ 12/30/2011 8:02:45 PM
RE: Form closing top level form Posted by Yuri Rubinov @ 12/29/2011 4:40:13 PM
RE: Form closing top level form Posted by Pete Sass @ 12/30/2011 7:02:42 PM