Share via


ViewChanges Element

The ViewChanges element in the GBUIStructure parent element defines how the Project Guide responds when you change views in Microsoft® Office Project 2003. For example, the Project Guide side pane List the tasks in the project helps you enter tasks and displays a task view in the main view area on the right. When you use the View menu to switch to the Resource Sheet view, the side pane content List the tasks in the project is no longer relevant.

The side pane content changes dynamically so that it is relevant to whatever view Project displays on the right. This change is controlled by the ViewChanges element, which has the following schema definition:

<element name="ViewChanges">
  <complexType>
    <element ref="ViewChange" maxOccurs="*" />
  </complexType>
</element>

The ViewChanges element can include multiple ViewChange elements. Following is the schema definition for a single ViewChange element:

<element name="ViewChange">
  <complexType>
    <choice maxOccurs="1" minOccurs="1">
      <element name="ViewType">
        <simpleType>
          <restriction enumeration="-1 0 1" />
        </simpleType>
      </element>
      <element name="ViewScreen">
        <simpleType>
          <restriction enumeration="1 2 3 4 5 6 7 8 9 10 11 12 13 14 15" />
        </simpleType>
      </element>
      <element name="ViewName" type="string" />
    </choice>
    <choice maxOccurs="1" minOccurs="1">
      <element name="GoalAreaID" type="decimal" />
      <element name="TaskID" type="decimal" />
    </choice>
  </complexType>
</element>

Each ViewChange element contains a pair of elements: one element in the set {ViewType, ViewScreen, ViewName} with one element in the set {GoalAreaID, TaskID}. When you switch views, this combination of elements in ViewChange specifies which goal area or which Project Guide side pane is displayed.

ViewType is used to broadly categorize views into task or resource views. The permitted values for ViewType are 0 for task views, 1 for resource views, and -1 for neither task nor resource views (this applies when Project displays Microsoft Office Project Web Access or other Web pages).

ViewScreen is a narrower category used to describe the nature of a view. For example, ViewScreen can specify whether the view is based on the Gantt Chart, the Network Diagram, or the Resource Sheet. The following table shows the permitted values for ViewScreen, which correspond to the different values defined for the pjViewScreen enumeration in the Project object model.

Value Enumeration
1 pjGantt
2 pjNetworkDiagram
3 pjRelationshipDiagram
4 pjTaskForm
5 pjTaskSheet
6 pjResourceForm
7 pjResourceSheet
8 pjResourceGraph
9 (undefined)
10 pjTaskDetailsForm
11 pjTaskNameForm
12 pjResourceNameForm
13 pjCalendar
14 pjTaskUsage
15 pjResourceUsage

ViewName identifies a specific view by its name. The values for ViewName can be any text string that corresponds to the name of a view in Project. ViewName can be set to the name of a custom view or to the name of one of the default views that are included in Project.

GoalAreaID and TaskID define goal areas and tasks in the Project Guide. These elements are explained in more detail in GoalArea Element.

Following is the ViewChanges element as defined in the default document gbui.xml:

<ViewChanges>
  <ViewChange>
    <ViewType> 0 </ViewType>
    <GoalAreaID> 1 </GoalAreaID>
  </ViewChange>
  <ViewChange>
    <ViewType> 1 </ViewType>
    <GoalAreaID> 2 </GoalAreaID>
  </ViewChange>
</ViewChanges>

The default ViewChanges element specifies that whenever the user switches to a view that is no longer relevant to the current side pane, the following occurs:

  • If the new view is a task view (ViewType=0), then the list of tasks for the Tasks goal area (GoalAreaID=1) is displayed.
  • If the new view is a resource view (ViewType=1), then the list of tasks for the Resources goal area (GoalAreaID=2) is displayed.

The concept of a relevant view for a Project Guide side pane is explained in detail in GoalArea Element.

The default Project Guide behavior performs fairly simple goal area changes based on the view type. However, the ViewChanges element does support more granular switching to a goal area or even to a specific side pane based on ViewScreen or ViewName. When you customize the Project Guide, you can get more advanced switching with a custom XML document that defines your own version of the ViewChanges element.