Show All

# TaskPane Object

TaskPanes TaskPane

Represents a task pane in a Microsoft Office InfoPath 2003 form that is associated with a window. The TaskPane object provides a number of properties for working with the InfoPath built-in task panes, and the HTMLTaskPane object inherits those properties and methods for working with a custom task pane.

## Remarks

The properties and methods that are available for an InfoPath task pane are determined by the type of task pane that you are working with. If the Type property of the TaskPane object returns 0, the task pane is a custom task pane and the properties and methods that are available are provided by the HTMLTaskPane object. If the Type property returns any other value, the task pane is a built-in task pane and the properties are provided by the TaskPane object directly.

Note The Type property is based on the XdTaskPaneType enumeration. These enumerated values are also used as arguments to the Item property of the TaskPanes collection for returning a reference to a specified type of task pane.

## Using the TaskPane object

In the following example from the User Interface developer sample form, the Item property of the TaskPanes collection is used to set a global reference to the TaskPane object that represents the custom task pane. The code then calls a scripting function defined in the HTML code of the custom task pane using the HTMLDocument property of the HTMLTaskPane object, which is inherited by the TaskPane object.

    function SetTaskPaneState()
    {

       // Ensure View has loaded before trying to access the task pane.
       if (XDocument.View)
       {
          // Get a reference to the custom task pane.  It is always the 0-th
          // task pane in the TaskPanes collection.
          if (gobjTaskPane == null)
             gobjTaskPane = XDocument.View.Window.TaskPanes.Item(0);

          // Ensure that the task pane is completely loaded.
          if (gobjTaskPane.HTMLDocument.readyState == "complete")
          {
             var strTaskPaneViewId = "TP_" + XDocument.View.Name.replace(/\W+/g, "");

             // Call a script function defined in the task pane HTML page.
             gobjTaskPane.HTMLDocument.parentWindow.SelectView(strTaskPaneViewId);
          }
       }
    }

©2003-2004 Microsoft Corporation. All rights reserved. Permission to copy, display and distribute this document is available at: http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp