ActiveX Controls Wonderware InTouch
ActiveX controls, originally known as OLE controls or OCXs, are standalone software components that perform specific functions in a standard way. ActiveX controls define standard interfaces for reusable components. ActiveX controls are not separate applications. Instead, they are servers that are placed into a control container. To use ActiveX controls, they must be placed in an ActiveX container. InTouch is an ActiveX container. Microsoft VisualBasic and internet browsers are also ActiveX containers.
ActiveX controls behave exactly like InTouch Wizards, except they bring compelling new functionality to InTouch applications. ActiveX controls can be created using Visual Basic, Microsoft VC++, or other 3rd party development tools. ActiveX controls can also be bought from third parties for specific functionality. These controls are packaged in the OCX form. Wonderware’s FactorySuite InTrack component also provides several ActiveX controls. Additionally, the IndustrialSQL Server Historian ActiveTrend allows you to run the IndustrialSQL Trend program (or a functional subset) from within InTouch. ActiveEvent allows you to notify the IndustrialSQL Event sub-system when an event has occurred in another application.
There are three main components of ActiveX controls: properties, methods, and events. Properties are very similar to variables that can be modified, e.g., Calendar.day, Control.height, and so on. Methods are similar to script functions that can be called from the container. For example, Browser.Navigate(“http://www.wonderware.com”), Engine.start(). Events occur through the ActiveX container. For example, Control.click (shift), FileViewer.DoubleClick (name), and so on.
InTouch allows access to ActiveX control properties, methods, and events. These properties can be associated with InTouch tagnames or can be accessed through InTouch QuickScripting.
Note: In order for an ActiveX Event script to function properly, the ActiveX control for which the script was created must be loaded into memory. If the window containing an ActiveX control is closed, its ActiveX Event scripts or any other InTouch QuickScripts containing script functions associated with that ActiveX control, will not execute properly.
One or more ActiveX controls can be used in your InTouch application. InTouch allows you to easily select and paste an ActiveX control into any application window and add them to the Wizards / ActiveX Toolbar. ActiveX Event scripts can also be imported from one application to another.
- NB Designer OMRON HMI Youtube Tutorial Videos
- DOPSOFT DELTA HMI Youtube Tutorial Videos
- Wonderware Intouch Youtube Tutorial Videos
- GT Designer MITSUBISHI HMI Youtube Tutorial Videos
- WinCC Siemens HMI Youtube Tutorial Videos
- FACTORY TALK VIEW Youtube Tutorial Videos
Using ActiveX Controls in InTouch
Install the ActiveX control(s) that you want to use.
Select and paste the ActiveX control into a WindowMaker window.
Configure the ActiveX control’s properties and assign them to tagnames.
Associate ActiveX events to ActiveX Event scripts.
Call ActiveX methods and set ActiveX control properties in ActiveX Event scripts or other InTouch QuickScripts.
The following WindowMaker edits can be made to an ActiveX control:
An ActiveX control’s size can be changed if sizing is supported by the control.
ActiveX controls can be duplicated, cut, copied, pasted and deleted.
All aligning commands (left, right, top, bottom, centerpoint) can be applied to an ActiveX control.
ActiveX controls can be added to the Wizards / ActiveX Toolbar.
ActiveX controls can be included with other objects when creating a cell.
The WindowMaker menu commands and their equivalent toolbar tools can be used to directly modify many ActiveX properties. For example, Reduce Font, Line Color, Fill Color, and so on.
InTouch does not support the following types of ActiveX controls:
Windowless Controls
Simple Frame Site (Group Box)
Containers
Data Controls
Dispatch Objects
Arrays, Blobs, Objects, Variant Types
Naming ActiveX Controls
Paste the ActiveX control into your WindowMaker window.
Double-click the control to open the Properties dialog box.
Each ActiveX control’s Properties dialog box is unique to the control. The number of tabs displayed is based on the properties of that particular control.
In some cases, you may need to configure Colors and Fonts . Others may not require this configuration. However, for all ActiveX controls, InTouch adds three tabs: Control Name, Properties and Events.
Click the Control Name tab and enter a unique name for the ActiveX control in the ControlName box.
Note: You must define a unique name for each ActiveX control used in your InTouch application. The Control Name is used in script functions to identify the control. For example:
#Calendar2.day = Tag1;
#Calendar2.year = 1997;
If you use the default Control Name, e.g., Calendar2 and you subsequently duplicate the ActiveX control, InTouch will automatically increment the Control Name. In this case, the duplicate ActiveX control’s name would be Calendar3.
Installing/Removing ActiveX Controls
Click Special / Configure / Wizard/ActiveX Installation to open the Wizard/ActiveX Installation dialog
box.
Click the ActiveX Control Installation tab.
In some cases, you may need to configure Colors and Fonts . Others may not require this configuration. However, for all ActiveX controls, InTouch adds three tabs: Control Name, Properties and Events.
Click the Control Name tab and enter a unique name for the ActiveX control in the ControlName box.
Note: You must define a unique name for each ActiveX control used in your InTouch application. The Control Name is used in script functions to identify the control.
For example:
#Calendar2.day = Tag1;
#Calendar2.year = 1997;
If you use the default Control Name, e.g., Calendar2 and you subsequently duplicate the ActiveX control, InTouch will automatically increment the Control Name. In this case, the duplicate ActiveX control’s name would be Calendar3.
Installing/Removing ActiveX Controls
Click Special / Configure / Wizard/ActiveX Installation to open the Wizard/ActiveX Installation dialog
box.
Add an ActiveX Control to the WindowMaker
Wizard/ActiveX toolbar the list of wizards, click the ActiveX Controls category. All installed ActiveX controls will be displayed.
Select the ActiveX control that you want to use and then click OK (or double-click the control). The dialog box closes and your window reappears.
Note: To add an ActiveX control to the Wizards/ActiveX Toolbar, click Add to toolbar. When a control is added to the Wizards/ActiveX Toolbar, it can be selected and pasted into your open window at any time. The number of ActiveX controls that can be added to the toolbar is limited to system resources
The cursor will change to the corner symbol when you return to the window. Click the location in the window to paste the ActiveX control.
Double-click the control to configure its properties.
Removing ActiveX Controls from the Toolbar
Click the Wizard dialog tool in the Wizards/ActiveX Toolbar. The Wizard Selection dialog box appears:
Remove an ActiveX Control from the WindowMaker Wizard/ActiveX toolbar Click Remove from toolbar.
The Remove Wizard from Toolbar dialog box appears: Select the ActiveX control(s) that you wish to remove from the toolbar.
Click OK.
Configuring ActiveX Control Properties
The properties that can be configured for a particular ActiveX control are determined by the ActiveX control designer. Each ActiveX control’s Properties property sheet displays three columns: Property, Range and Associated Tag. The Property and Range columns are read-only. The Associated Tag column is used to associate InTouch tagnames with the respective property in the Property column. Note: When certain items in the Range column are clicked, an arrow appears. This arrow can be clicked to view the list of possible values for the item. The items in the list are for viewing purposes only and cannot be changed. Click the Properties tab in the Calendar Properties dialog box.
Click in the middle of each cell in the Associated Tag column and enter a tagname for the respective property. If a tagname is entered that has not been defined in the Tagname Dictionary, you will be prompted to define it now.
If you double- click a blank cell, or click the button, the Tag Browser will appear displaying the tagnames for the selected tag source. Double-click the desired tagname or select it and click OK. The tagname is automatically inserted into the cell.
When the tagname is specified, double-click in the cell to the left of the tagname. Select the association direction for the tagname to its respective property. Continuously double-clicking will cycle you through the various association direction choices.
There are actually two fields in each cell in the Associated Tag column. The association direction selection and the tagname entry. The ActiveX control determines the association direction and the property type determines the tagname type that must be used.
You can select one directional or bi-directional association. However, if the association direction you select is not valid for the property or tagname, the control will automatically change it accordingly. For example, if you select when the tagname’s value changes, its associated property is changed accordingly. A certain subset of the symbols below will appear based on the potential relationship between the property and the tagname.
For example, if you associate a property to a writeable tagname, you will see a different set of associations than if you associate the same property to a read-only tagname. Select the appropriate association symbol as follows:
The tagname sets the value of the associated property.
The property is read-only and the tagname cannot change the property’s value.
The property sets the value of the associated tagname.
The tagname is read-only and the property cannot change the tagname’s value.
The value can be set from either the tagname or the property. (Tagname takes precedence.)
The tagname and the property are both read-only.
The tagname can change the property’s value, but the property cannot change the tagname’s value. The property cannot change the tagname’s value because the property is non-bindable or the tagname is read-only.
The property can change the tagname’s value, but the tagname cannot change the property’s value. The tagname cannot change the property’s value because the property is read-only.
Click OK.
Note: Properties can be accessed or changed through ActiveX Event scripts and/or other InTouch QuickScripts. All ActiveX script functions are qualified by the # (pound) sign. The valid syntax to access ActiveX properties is:
#ControlName.PropertyName
Examples: #Calendar2.Day = 29; Tag1 = #Calendar2.year;
Using ActiveX Control Methods
ActiveX control methods are similar to ActiveX control properties. Methods are activated in Runtime (WindowViewer). ActiveX control methods are accessed through ActiveX Event scripts and/or other InTouch QuickScripts.
Note: In order for an ActiveX Event script to function properly the ActiveX control for which the script was created must be loaded into memory. If the window containing an ActiveX control is closed, its ActiveX Event scripts (or any other InTouch QuickScripts containing script functions associated with that ActiveX control) will not execute properly.
1.In the ActiveX control’s Properties dialog box, click the Events tab.
2.Double-click a blank cell in the Script column.
The ActiveX Event Scripts editor appears:
Click on Insert / ActiveX.
The ActiveX Control Browser appears:
In the Control Name list, select the ActiveX control whose methods or properties you want to access.
The names of all ActiveX controls currently being used in your application will be listed.
Note: If you select This Control instead of the actual Control Name, the methods and properties displayed will be those for the ActiveX control currently selected in your application. By selecting This Control instead of the actual Control Name, you can create generic ActiveX Event script functions. You can then copy and paste these functions into any other ActiveX Event script or any other InTouch QuickScript without having to change the Control Name in the new script.
For example:
#ThisControl.Navigate (“http:\www.wonderware.com”); #ThisControl.Navigate(URL); { where URL is a tagname}
This Control is accessible only through ActiveX Event scripts. It is not accessible through any other type of InTouch QuickScript.
In the Method / Property list, select the method or property that you want to use in your script. Properties are the items in the list that include parentheses. For example, Display().
Click Done.
The selected control name and method or property are automatically inserted into your script.
ActiveX control’s methods and properties are also accessed through the Insert menu in all other InTouch QuickScripts types.
Using ActiveX Control Event Parameters
ActiveX control events can be executed in Runtime (WindowViewer) by designing a particular action and associating it to the event. For example, if your ActiveX control has an error event handler, you could create an ActiveX Event script that displays a window with an error message when an error occurs. ActiveX Event scripts are provided to support event actions. You can associate a named event script to each event.
Note: In order for an ActiveX Event script to function properly the ActiveX control for which the script was created must be loaded into memory. If the window containing an ActiveX control is closed, its ActiveX Event scripts (or any other InTouch QuickScripts containing script functions associated with that ActiveX control) will not execute properly.
Double-click the ActiveX control for which you want to create an ActiveX Event script to open the ActiveX control’s Properties dialog box.
Click the Events tab.
In the Event column, select the event to which you want to associate an ActiveX Event Script.
In the respective cell in the Script column, enter a unique name for the ActiveX Event Script that you want to create andthen double-click the name or click OK.
The following message box appears:
Click OK.
The ActiveX Event script editor appears displaying the name you entered in the Name input box (see following example). If you double-click a blank Script cell when the ActiveX Event script editor appears, you must then enter a name for the ActiveX Event script.
Click the button if the ActiveX Event script that you want to use already exists.
The Choose ActiveX Script dialog box appears listing all existing ActiveX Event scripts in your application:
Click Insert/ActiveX.
The ActiveX Control Browser appears:
In the Control Name list, select This Event to access the parameters for the selected event. In this case, the selected event is Error.
Note: This Event is accessible only through ActiveX Event scripts. It is not accessible through any other type of InTouch QuickScript. You must select This Event to access the event parameters for an ActiveX control.
Events may or may not pass parameters in Runtime. Event parameters can be accessed by using the ThisEvent keyword.
For example: MyActiveXErrorNumber = #ThisEvent.ErrorNumber;
Where: # indicates that this is an ActiveX script function, ThisEvent relates to the event selected in the ActiveX control’s Event property sheet, and ErrorNumber is the parameter passed by the selected event.
In the Method / Property list, select the event to use in your ActiveX Event script.
Click Done.
The selected control name, e.g., This Event, and selected event parameter are both automatically inserted into your script at the cursor location.
For example:
Click OK to save your ActiveX Event script and close the script editor. The ActiveX control’s Properties dialog box reappears. Click OK to close the Properties dialog box or continue to create ActiveX Events scripts.
ActiveX Event Scripts
Most ActiveX controls have events associated with them. For example, click, double-click, mouse down and key press are typical events used in many ActiveX controls. InTouch ActiveX Event scripts are provided to support event actions. One ActiveX Event script can be associated with each event. ActiveX control events are executed in Runtime (WindowViewer).
Accessing the ActiveX Event Script Editor Click the Events tab in the ActiveX control’s Properties dialog box to activate the Events property sheet.
Double-click a blank cell in the Script column or enter a name for the ActiveX Event script and click OK.
If an ActiveX Event script for the name you enter does not currently exist, a message box will appear asking you if you want to create it now. Click OK. The ActiveX Event Scripts editor appears:
In the Name box, enter the name to identify the ActiveX Event script. ActiveX control methods are similar to ActiveX control properties. To access the ActiveX control methods, click on the Insert / ActiveX command.
The ActiveX Control Browser appears:
The ActiveX Control Browser will display the names of all ActiveX controls being used in your application. When you select a control’s name, its respective methods will be displayed. Select the method to insert into your script and then click Done.
Reusing ActiveX Event Scripts
ActiveX Event scripts can only be reused for the same event for the same kind of ActiveX control. For example, the mouse down event may be a stock event on hundreds of ActiveX controls. However, an ActiveX Event script written for mouse down on ActiveX ControlA cannot be reused for mouse down on ActiveX ControlB unless the two controls are the same type.
Double-click the ActiveX control for which you want to reuse an existing ActiveX Event script. The selected ActiveX control’s Properties dialog box will appear.
Click the Events tab. T
The MyActiveX Control2 Properties window displays:
In the Script column for the respective event, click the button. The Choose ActiveX Script dialog box appears:
Note: This dialog box will only display the ActiveX Event scripts that were written for the same type of ActiveX control and the same selected event. For example, let’s assume that you are creating an ActiveX Event script for a second ActiveX Calendar control’s “Click” event. You have already created two other ActiveX Event scripts named Click1 and Click2 in your application.
Click1 was created for a different ActiveX Calendar control’s “Click” event and
Click2 was created for an ActiveX InSQLTrend control’s “Click” event. When you click the button and the Choose ActiveX Script dialog box appears, it will only display the Click1 script since it was created for the same type of ActiveX control and the same event.
.
Select the ActiveX Event script that you want to use and click OK.
The name of the selected script is automatically inserted into the Script cell where you previously clicked the button.
For example:
5. Click OK to close the Properties dialog box or continue to create ActiveX Events scripts.
Importing ActiveX Event Scripts
Importing ActiveX Event scripts from another InTouch application to your current application can save considerable amounts of development time. When you move ActiveX Event scripts from one InTouch application to another, you must use the File / Import command.
Note: When you import ActiveX Event scripts from one application to another, all ActiveX Events scripts are imported. Additionally, in order for an imported ActiveX Event script to function properly in the new application, the same ActiveX control and the same event for which the script was originally created must also be used in the new application, and it must be loaded into memory.
If the window containing an ActiveX control is closed, its ActiveX Event scripts or any other InTouch QuickScripts containing script functions associated with that ActiveX control will not execute properly.
Also Read:-