Skip to main content
InSource Solutions

TN - 1122 Extending a WebBrowser Control

Description

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.

 clipboard_ea64e60810464d100c2433e2ef71ab2a3.png

 

Build project in release mode.

clipboard_e597d3a6994c98970373e1f0e25e8ffd2.png

 

Import the compiled .dll from the release folder ....

clipboard_ea23d6e0a9ecc31985819e83d3de62878.png

 

...into the Galaxy by selecting  Galaxy > Import > Script Function Library

clipboard_e813f47f15aecad271e84ecc489351180.png

 

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)

 clipboard_e8a88bbdd71a200e55f3f6f6e196b758d.png

 

Although the value is hard coded, you can see the property we added in VS .OperatorUpdatingForm  is available in the script editor.

clipboard_e9d2cbe055eedeb34418382844c813a1d.png
 

In Runtime the browser property displays the hard coded value. 

 

clipboard_e4ef8175fdf2f66e46277333b915f78ff.png

 
 

  • Was this article helpful?