This guide discusses a basic example for adding additional functionality or customizing a .Net control. This can be applied to most .Net controls but we will be focusing on the WebBrowser control. This article assumes you are familiar with the IDE, ArchestrA graphics and Visual Studio .
- Author: Mario Meza
- Published: 3/19/2021
- Applies to: ArchestrA graphic / Industrial Graphic
You may encounter a scenario where you might want to access application values from a .Net control (like the WebBrowser control). This can be used to to pre-populate fields, track user details, validate user input, etc. One way to accomplish this is to create a new control that inherits from the original control using Visual Studio.
In Visual Studio create a Windows Forms Control Library and inherit from the WebBrowser control.
(In the image below the ExtendedWebBrowser is inheriting from the WebBrowser control.)
Notice a public property named OperatorUpdatingForm has been added. This is so the InTouch operator name can be passed to the control.
Build project in release mode.
Import the compiled .dll from the release folder ....
...into the Galaxy by selecting Galaxy > Import > Script Function Library
You should now see the control in the Graphic Toolbox like any other control. Create a new symbol and embedded the imported control.
In the image below the Symbol is called ExtendedBrowser and the control is ExtendedWebBrowser (identified with the Green icon)
Although the value is hard coded, you can see the property we added in VS .OperatorUpdatingForm is available in the script editor.
In Runtime the browser property displays the hard coded value.