main logo
Subject: Releasing a form - doesn't!
Author: Larry Bradley
Posted: 2001/01/23 17:01:58
 
View Entire Thread
New Search


G'Day.
Maybe I'm dense. I've been programming in VFP since day one, and never ran across this before.

Calling the release method of a form from within a method of the form DOES NOT RELEASE the form! At least, not at the point where the release method is called. I really can't believe this is true, but I just tested it.

I placed a command button on a non-modal form. The click method of the button calls 'thisform.testrelease()'

thisform.testrelease looks like:

activate screen
? "Start of release"
thisform.release()
? "We should not get here"


Unfortunately, we DO get here!

If I put display code into the destroy() method, destory does NOT get called when the release is called, but only after the testrelease method has terminated.

What am I missing here?

This comes up because in a CodeBook app, several methods deep in a form class, I encounter a situation where I want to issue a message and then close the form. Can't do it. All the code after the 'thisform.release()' still runs.

I can work around it in several ways, but this strikes me as weird.

Any thoughts?
Larry Bradley (lhbradley at igs DOT net)
FoxPro Developer
Ottawa, Canada
 
©2001 Larry Bradley
<-- Prior Message New Search Next Message -->