Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

ShowDoc, HideDoc

These events fire when an ActiveDoc is first displayed, and when the user navigates away from it, respectively.

Usage

PROCEDURE acdActiveDoc.ShowDoc
PROCEDURE acdActiveDoc.HideDoc

As far as we can tell, using IE 4, ShowDoc always fires after Init for the ActiveDoc. We suspect that in IE 3, with its cache that lets you go back to an ActiveDoc application after navigating elsewhere, ShowDoc also fires when you do, so it’s sort of an application-level Activate.

HideDoc fires when you navigate away from the ActiveDoc in the Browser. Since you can arrange to have an independent VFP window open up at that point to host the application, that means you can’t assume that HideDoc firing indicates that the ActiveDoc is about to be destroyed. And, in fact, you can’t even assume that HideDoc always fires. If you run an active doc application in VFP rather than a browser, HideDoc never fires. (This is even odder than it sounds because ShowDoc fires, regardless of the host.)

We suspect that ShowDoc isn’t really terribly useful, except when you’re running in IE 3 or another browser with a cache. In that case, it lets you know when you’ve returned to the application from some other page. We can’t think of many reasons to use HideDoc, either. The one time we might want to put some code in it, when the app is jumping from the browser to VFP, we can just as well use ContainerRelease. However, we’ll never turn up our noses at “extra” events. Sooner or later, there’s a time when they come in handy.

Example

PROCEDURE ShowDoc
WAIT WINDOW "ShowDoc is firing"
ENDPROC

PROCEDURE HideDoc
WAIT WINDOW "HideDoc is firing"
ENDPROC

See Also

ActiveDoc, ContainerRelease, Destroy, Init