These events fire when forms and pages become active or inactive. For a project hook, these events fire when the associated project becomes active or inactive.
PROCEDURE oObject.Activate | oObject.DeactivateForms, formsets, toolbars, pages and project hooks all have these events, and their behavior feels a little different for each. Let's start with toolbars because they're the simplest. A toolbar's Activate fires when you Show the toolbar. Its Deactivate fires when you Hide it. Period. End of story—even if the toolbar has a control on it that can gain focus. It doesn't matter—Activate doesn't fire even when you land on that control.
A form's Activate fires whenever that form comes to the top (conceptually—it may not be physically "on top"). Normally this happens because the user clicks on the form while another form has focus or because the tab sequence brings focus to a control on the form. A form's Deactivate fires whenever another form gets focus. Show and Hide fire Activate and Deactivate respectively, too.
A formset's Activate fires whenever any form in the set is activated. That's right, the formset's Activate fires when a different form comes to the top. In fact, the formset's Activate fires after the Deactivate of the old form and before the new form's Activate. The formset's Deactivate fires only when you Hide the formset or focus moves out of the formset.
Now, the oddball in this group. In VFP 7, Activate and Deactivate were added to the ProjectHook base class, something we'd devoutly hoped for. As you'd expect, Activate fires whenever the associated project gets focus, and Deactivate fires when the project loses focus (say, when you click into the Command Window). These events are most useful when you have multiple projects open, because you can make sure each has the appropriate environment, so you use the right controls, store things in the right place, and so forth.
Destroying an object does not fire its Deactivate event, nor does creating it fire its Activate event. The latter is an issue for project hooks, in one situation. When you choose to have VFP reopen a project at startup (by checking the appropriate check box in the Options dialog), the associated project hook's Activate method doesn't fire on the way in. The work-around here is to call the same code from the Init method.
* Only the active page in a page frame is refreshed by
* the PageFrame's Refresh method. So, when you move a page
* to the top, it's generally a good idea to refresh it.
* You'd do that in the page's Activate method:
This.Refresh()Activate Window, Deactivate Window, Form, Formset, Hide, Page, PageFrame, ProjectHook, Show, Toolbar, UIEnable

