VERSIONS: All, written for Paradox 5
SUBJECT: Form - close(), formReturn(), formCaller()
BY: MARK PAUKER
It is possible that a user can interact with a form after you issue the fm.open(), but before you issue the fm.wait(). In situations where this
occurs, instead of simply issuing a formReturn(), you might consider the following:
if formCaller(fm) then
formReturn()
endIf
Since formCaller will only return True when the form is being waited on, this will cause the formReturn to be ignored if pressed to early.
The downside to this approach is that if you open the form interactively, it can become quite difficult to close. A variation that I've used is
setting a timer that sets a global variable a few seconds after the form is opened, and then substituting the following:
if loTimeout.isAssigned() then
formReturn()
endIf
This way, the formReturn() is disabled until the timer method fires (which in turn sets loTimeout to True). This provides a pause to allow the
fm.wait() to be invoked before the formReturn() is executed.
I personally prefer the first technique because it is independent of timing issues, and during development, I simply add a button that allows
me to close the form whenever I want.