ActiveScript: Creating forms that are intially hidden

Article ID: 105
Last updated: 22 Jun, 2018
Article ID: 105
Last updated: 22 Jun, 2018
Revision: 3
Views: 1859
Posted: 13 Dec, 2000
by Meltreger B.
Updated: 22 Jun, 2018
by Meltreger B.

Problem


How do I create an initially hidden form?


Cause



Action


The form object has a Hide() method, which can be called from the OnLoad event. However, this will not hide the form if it is run immediately after opening it. In this case, it is necessary to add an override in the frame class that contains the script host view:

void FormFrame::ActivateFrame(int nCmdShow) 
{
	\ This is a workaround to allow forms to be hidden when they're
	\ initially opened.  Without doing this, the Form's Hide method and 
	\ Visible property don't work for newly opened forms.

	\ Only activate if frame is supposed to be visible.
	CDocument* pDoc = GetActiveDocument();
	ASSERT(pDoc->IsKindOf(RUNTIME_CLASS(VdScriptHostDoc)));

	if (static_cast<VdFormObj*>
			(static_cast<VdScriptHostDoc*>(pDoc)->GetFormObj())->IsVisible())
		SECFrameWnd::ActivateFrame(nCmdShow);
}

This article was:   Helpful | Not helpful
Report an issue
Article ID: 105
Last updated: 22 Jun, 2018
Revision: 3
Views: 1859
Posted: 13 Dec, 2000 by Meltreger B.
Updated: 22 Jun, 2018 by Meltreger B.

Others in this category