Configure the Show/Hide Content script functions
- Last UpdatedJan 16, 2025
- 3 minute read
Use the Show/Hide Content functions in layout scripts, Industrial Graphic scripts, or Application Server object scripts to populate a pane with a specific graphic, layout, or external content object in an AVEVA OMI ViewApp. You can call the same script multiple times to refresh content, or to show the content in a different pane. If you choose to display the same content in different panes, you can alter its settings through the ParameterOverride parameter.
If ShowContent calls the same content item while it is open, ShowContent searches for open content items that match the specified parameters in the call. Any matching items are closed and then reopened. If the content has changed, the latest changes are shown when the content is redisplayed.
Important: The Show/HideContent functions can be used in a graphic or layout action script, named script and pre-defined script. Although the system allows you to include it in a server script, such as Start Up, On Scan, Off Scan, Shut Down and Execute, you will not be able to execute the function at runtime.
To include a script that contains the Show/Hide Content functions within a script
-
Open the System Platform IDE.
-
Open a new or existing graphic or layout.
-
To add a layout script, select the Script tab.
-
To add a graphic script, create a graphic and open it for editing. Double-click it to open the Edit Animations page, then open the script editor and select the Display Script Function Browser icon. The Script Function Browser appears. Select the ShowContent() script function in the Graphic Client list, and then select OK. The following code snippet is added:
Dim contentInfo as aaContent.ContentInfo;
contentInfo.Content = "<ContentName>";
ShowContent( contentInfo );
Note: You can select Help to view the Help after you have selected any Graphic Client script function.
-
-
Modify the script as needed. ContentInfo is a predefined structure that contains data members listed below. Content is the only required parameter. For more information about the Show/Hide Content, see the AVEVA Scripting Guide.
-
Content: name of the content (graphic, layout, or external content object) to be loaded into the pane. Content is a string and is the only required parameter.
-
Name: name property of the content. This is automatically created when the content is added to the layout.
-
ScreenName: name of the screen that contains the pane in which to load the content. ScreenName is a string.
-
SearchScope: when ScreenName is not specified, SearchScope determines which screens within the Screen Profile are searched for a pane in which to place the content. SearchScope is an enum that can be set to one of the following values:
-
Self: This is the default. Searches for matching content within the panes of the layout from which the ShowContent call was made. Self will search from a nested (embedded) layout, if the call was made from that layout. The remaining SearchScopes search ONLY the top level if there are nested layouts.
-
AllScreens: Searches the top level layout on all screens, starting with the source screen, then the primary screen, and then any remaining screens in alphabetical order. The search stops as soon as a matching pane is found. If a matching pane is not found, Content is placed in the default pane of the source screen.
-
SourceScreen: Searches the top level layout only in the source screen (the screen that made the ShowContent call).
-
PrimaryScreen: Searches the top level layout only in the primary screen, as designated in the Screen Profile.
-
-
PaneName: name of the pane in which to load the content. PaneName is a string.
-
ContentType: specifies the type of content to be loaded. The ContentType can be matched against the Content Type designation that was set for a pane. ContentType is a string.
-
PropertyOverrides: specifies overrides for custom properties. This parameter is only valid if a graphic is the designated content. It is not valid if a layout has been designated. PropertyOverrides is a ValuePair structure.
-
OwningObject: specifies an automation object as an owning object.
-
Example
Dim contentInfo as aaContent.ContentInfo;
Dim cpValues [2] as aaContent.PropertyOverrideValue;
cpValues[1] = new aaContent.PropertyOverrideValue("CP1", "20", true);
cpValues[2] = new aaContent.PropertyOverrideValue("CP2", "Pump.PV.TagName", false);
contentInfo.Content = "S1";
contentInfo.ContentType = "Overview";
contentInfo.OwningObject = "Enterprise";
contentInfo.PaneName = "Pane1";
contentInfo.ScreenName = "Wall";
contentInfo.PropertyOverrideValues = cpValues;
contentInfo.SearchScope = aaContent.SearchScope.PrimaryScreen;
ShowContent ( contentInfo );