1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
<html dir="ltr"><head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<META HTTP-EQUIV="assetid" CONTENT="HV01021252"><META NAME="lcid" CONTENT="1033"><title>Window Object</title><link rel="stylesheet" type="text/css" href="office10.css"><script type="text/javascript" language="Javascript" src="ExpCollapse.js"></script><script type="text/javascript" language="JavaScript" src="inline.js"></script></head><body><p id="ExpandAllLine" class="ExpFav"><a href="#" onclick="ExpandAll()" onkeypress="ExpandAll()" class="DropDown"><img id="picHeader" border="0" src="expandtri.gif" alt="Show All"><span id="ExpandAll">Show All</span></a></p><h1>Window Object</h1><div class="ofvbanav"><span class="ofvbanavreuse" id="seealso" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="properties" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="methods" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="events" onclick="toggleList()" onkeypress="toggleList()"></span><span class="ofvbanavreuse" id="specifics" onclick="toggleList()" onkeypress="toggleList()"></span></div><table class="ofvbaomart"><tr><td class="noborder" nowrap="true"><A HREF="xdcolWindows.htm" title="Windows"><SPAN tabindex="0" class="omyellow" id="ParentObject">Windows</SPAN></A><BR /><IMG SRC="../img/parchild.gif" BORDER="0"></IMG><A HREF="xdobjWindow.htm" title="Window"><SPAN class="omblue">Window</SPAN></A><br /></td></tr></table><p>Represents a window that is used in the Microsoft Office InfoPath 2003 application. <b class="bterm">Window</b> objects represent the two types of windows that are used in the InfoPath application: the editing window that is used as the <a href="#" class="glossary" onclick="AppendPopup(this,'xdformarea')" onkeypress="AppendPopup(this,'xdformarea')">form area</a> when a user fills out a form, and the designing window that is used as the <a href="#" class="glossary" onclick="AppendPopup(this,'xddesignmode')" onkeypress="AppendPopup(this,'xddesignmode')">design mode</a> when a user designs a form.</p><h2>Remarks</h2><p>The <b class="bterm">Window</b> object provides a number of properties and methods that can be used to programmatically interact with InfoPath windows, including the ability to activate or close a window and the ability to interact with the <a href="#" class="glossary" onclick="AppendPopup(this,'OfTaskPane')" onkeypress="AppendPopup(this,'OfTaskPane')">task panes</a> and <a href="#" class="glossary" onclick="AppendPopup(this,'ofdefCommandBar')" onkeypress="AppendPopup(this,'ofdefCommandBar')">command bars</a> that they contain. The <b class="bterm">Window</b> object also provides a property for accessing the form's underlying XML document that is associated with the window.</p><p><b>Note</b> Some properties of the <b class="bterm">Window</b> object are only available when using the editing window type; they will return an error if used with the designing window type.</p><h2>Using the Window object</h2><p>The <b class="bterm">Window</b> objects of an InfoPath form are accessed through the <b class="bterm"><a href="xdproItem_1.htm" id="HV01021294" lcid=" ">Item</a></b> property of the <b class="bterm"><a href="xdcolWindows.htm" id="HV01021189" lcid=" ">Windows</a></b> collection. The type of window can be determined by the <b class="bterm"><a href="xdproType_1.htm" id="HV01021344" lcid=" ">Type</a></b> property of the <b class="bterm">Window</b> object.</p><p>You can access the currently open window directly by using the <b class="bterm"><a href="xdproActiveWindow.htm" id="HV01021262" lcid=" ">ActiveWindow</a></b> property of the <b class="bterm"><a href="xdobjApplication.htm" id="HV01021256" lcid=" ">Application</a></b> object, without going through the <b class="bterm">Windows</b> collection. You can also access the <b class="bterm">Window</b> object that is associated with a view by using the <b class="bterm"><a href="xdproWindow_2.htm" id="HV01021356" lcid=" ">Window</a></b> property of the <b class="bterm"><a href="xdobjView.htm" id="HV01021249" lcid=" ">View</a></b> object.</p><p>In the following example, implemented as an OnClick <a href="#" class="glossary" onclick="AppendPopup(this,'xdeventhandler')" onkeypress="AppendPopup(this,'xdeventhandler')">event handler</a> for a button control, the <b class="bterm">ActiveWindow</b> property is used to set a reference to the current window. Then the code checks the window type; if it is the editing window type, it displays the number of task panes contained in the window in a message box.</p><pre><code>function WindowObject::OnClick(eventObj)
{
var objWindow;
// Set a reference to the current window.
objWindow = Application.<b class="bterm">ActiveWindow</b>;
// Check that the window is an editing window type.
if (objWindow.Type == 0)
{
// Display the number of task panes in the window.
XDocument.UI.Alert("Number of task panes: " +
objWindow.TaskPanes.Count);
}
objWindow = null;
}</code></pre><p>For more information about using the <b class="bterm">Window</b> object, see <a href="inconWorkingWithFormWindows.htm" id="HV01039909" lcid=" ">Working with form windows</a>.</p><script type="text/javascript" language="JScript" src="ofvbanl.js"></script><span id="ofVBAISpan" class="ofvbaispan"><iframe id="ofVBAIFrame" frameborder="0" marginheight="0" marginwidth="4" scrolling="auto" width="100%" src="../links/xdobjWindow_l.htm"></iframe></span><center><a href="XMLSchemaCopyright_HV01147162.htm">©2003-2004 Microsoft Corporation. All rights reserved.</a>
Permission to copy, display and distribute this document is available at: <a
href="http://r.office.microsoft.com/r/rlidAWSContentRedir?AssetID=XT010988631033&CTT=11&Origin=HV011232471033"
target="_new">http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp</a></center></body></html>
|