Controlling Views with Digital Objects or VBA
Views can be activated by using either a digital object as a controlling object or by using VBA code.
Using digital objects
You can define a digital object as a controlling object for global and diagram views. Once you have assigned a digital object to be a controlling object for a global or diagram view, the state of the controlling object will activate a view and deactivate all other views.
You can assign one controlling object for each diagram and one controlling object for the global views.
The Controlling Object for global views is set from the Views menu, whereas the Controlling Objects for each diagram is set in the Diagram Properties form .
Multiple controlling objects
You can use the same digital object to activate Global as well as Diagram views, although it is recommended to use separate digital objects to control activation of separate views.
Operator input
By default, a view that is controlled by a digital object cannot be changed by the operators using the Views menu, but you can select the Overridable by object check box in the Controlling Object form when defining the controlling object to allow operators to change the views in the Views menu.
The operators will still be able to change the controlling object state if the controlling object is accessible for manipulation in the Supervise modue.
States of the Controlling object
The Controlling Object will activate the view whose list position corresponds to the present state of the object.
- For global views, the state of the controlling object corresponds to the position of the views in the list in the Views menu in the Definition module.
- For diagram views, , the state of the controlling object corresponds to the placement of the views in the list in the Define Views field on the Diagram Properties form.
For example, for a Global Controlling Object in state = 0, the first listed Global View will be activated and all others deactivated. For a Diagram Controlling Object in state = 0, the first listed first Diagram View will be activated.
For the next state of the digital object (state = 1), the second view from the list will be activated and so on.
Changing the list placement of the views
The sequence of the views listed in the Views menu can be changed anytime. To do this, select a view from the View menu. Then select the View menu again and click Edit. From the Edit View dialog box, change the number in the Position field.
For an illustration of how to set up a digital object to control the active view see: "Scenario of Use for Layers - Example 2"
Using VBA
When using VBA code to control the active views the CurrentView property is provided. This property is available for both the Configuration VBA object (global views) and for each individual diagram VBA object (diagram views).
The associated active views are selected in a similar way as with digital objects, hence CurrentView = 0 corresponds to the first view in the Views list.