Windows Collection

Microsoft Office InfoPath

Show All Show All

Windows Collection

Windows Window

Contains a Window object for each window within a Microsoft Office InfoPath 2003 form. Window objects represent the two types of windows that are used in the InfoPath application: the editing window that is used as the form area when a user fills out a form, and the designing window that is used as the design mode when a user designs a form.

Remarks

The Windows collection implements properties that can be used to access a form's associated Window objects, and it is accessible through the Windows property of the XDocument object.

Note  The Windows collection can be used only to get the count of Window objects that it contains or to return a reference to a specified Window object. It cannot be used to create, add, or remove Window objects.

Using the Windows collection

In the following example, implemented as an OnClick event handler for a button on a form, the Windows property of the Application object is used to set a reference to the Windows collection. The code then loops through the collection and displays the type of each Window object that it contains.

    function ShowWindowTypes::OnClick(eventObj)
{
   // Set a reference to the Windows collection.
   var objWindows = Application.Windows;
   var strWindowType;

   // Loop through the collection and display the type
   // of each Window object that it contains.
   for (i=0; i < objWindows.Count; i++)
   {
      switch (objWindows(i).Type)
      {
         case 0:
            strWindowType = "Editing window";
            break;
         case 1:
            strWindowType = "Designing window";
            break;
      }

      XDocument.UI.Alert("Window type " + i + ": " + strWindowType);
   }
   objWindows = null;
   strWindowType = null;
}

  

For more information about using the Windows collection, see Working with form windows.