$doctitle = "Keeping Forms Open when Changing Directories"; $authname = "Lance Leonard"; $versions = "Applies to: Paradox 5.0"; $postdate = "12 July 2000"; $pagearea = 2; $audience = 2; $navlinks = 'Paradox'; $metakeys = "paradox objectpal forms open working directories menuaction"; $metadesc = "Describes how to keep forms open when changing directories"; ?> include( $DOCUMENT_ROOT . "/lib/pageinit.php" ); ?>
Answer: By overriding the default behavior of the form's menuChangingWork menuAction() and setting the menuAction's eventInfo errorCode() to a non-zero value. For example, consider the following code:
method menuAction( eventInfo menuEvent )
if not eventInfo.isPreFilter() then ; execute for form only
if eventInfo.id() = menuChangingWork then
eventInfo.setErrorCode( userError )
endIf
endIf
endMethod
This also works with changing the private directory. To keep forms in this case, replace the menuChangingWork constant with menuChangingPriv.
Since menuAction is only supported on forms, this means you cannot keep reports, scripts, or libraries open when changing the working or private directories. To work with this limitation, add code that reopens the these documents after the default behavior of the relevant constant. For example, the following code shows how to re-open a library after changing the working directory:
method menuAction( eventInfo menuEvent )
if not eventInfo.isPreFilter() then ; execute for form only
if eventInfo.id() = menuChangingWork then
eventInfo.setErrorCode( userError )
doDefault
openLibrary() ; custom method for opening library
endIf
endIf
endMethod
Note: There are very few cases where this is really necessary. If you find yourself needing this behavior in many applications, you may wish to consider using aliases more heavily. There are legitimate uses for this technique, however, you should use it sparingly.
include( $DOCUMENT_ROOT . "/lib/pagecomp.php" ); ?>