Container script scenario
- Last UpdatedJul 08, 2024
- 2 minute read
The following scenario illustrates the use of Show/Hide Graphic script functions inside a container script: You want to automatically show a graphic upon closing the graphic already showing. This entails creating a ShowGraphic script for one graphic, then creating a ShowGraphic script for a second graphic inside an OnHide predefined script.
To execute the container script scenario
-
Create a graphic, such as a pump, called "symbol01" and another "symbol02".
-
Add a button named "Close" to symbol01 on the Industrial Graphic Editor canvas, and add an action script to the button:
HideSelf();
-
Add a button named "Show Pump" in symbol02 on the Industrial Graphic Editor canvas and add an action script to show the graphic, as in the following script example:
Dim graphicInfo as aaGraphic.GraphicInfo;
graphicInfo.Identity = "showpump_script001";
graphicInfo.GraphicName = "symbol01";
graphicInfo.WindowType = aaGraphic.WindowType.Modeless;
graphicInfo.WindowRelativePosition = aaGraphic.WindowRelativePosition.Window;
graphicInfo.WindowLocation = aaGraphic.WindowLocation.Bottom;
ShowGraphic( graphicInfo);
-
Add an OnHide script in symbol01. In the script editor, add a ShowGraphic function for the second graphic, symbol02, as in the following script example:
Dim graphicInfo as aaGraphic.GraphicInfo;
graphicInfo.Identity = "showpump_script001";
graphicInfo.GraphicName = "symbol02";
graphicInfo.WindowType = aaGraphic.WindowType.Modeless;
graphicInfo.WindowRelativePosition = aaGraphic.WindowRelativePosition.Window;
graphicInfo.WindowLocation = aaGraphic.WindowLocation.Bottom;
ShowGraphic( graphicInfo);
The ShowGraphic for your second graphic is now configured inside the predefined (container) script.
-
Go to run time and open the window containing the "show pump" button.
-
Click the "show pump" button. Symbol01 displays.
-
Click the "close button" on symbol01. Symbol02 now displays in place of symbol01.
-
In this scenario, you configure and demonstrate a ShowGraphic script inside a predefined script, and use it to automatically display a second graphic upon closing the first.
By extension, you can configure more graphics the same way, accessing a sequence of graphics at run time with only one button occupying your display. You can use other container scripts, such as OnShow and WhileShowing, as well as named scripts in the same manner.