There are times when you may want to establish a direct connection to a data source, such as when you want to connect iFIX objects to some third-party controls. For more information, see the Creating Pictures manual.
The following figure illustrates the concept of a direct connection.
Direct Connection Example
You can form a direct connection either by using the Animations dialog box or by writing a script. Both methods are described below.
NOTE: You cannot perform a Find and Replace on an object when that object has a direct connection to another object. To perform a find on an object in an object to object connection, use the One Tag search type in the Cross Reference Tool. For more information, refer to the Searching for One Tag section of the Mastering iFIX manual.
To make a direct connection using
the Animations dialog box:
- Open the object's Animation dialog box.
- Click the Size tab, and then click the height check box.
- Enter a data source to animate the object's property.
- In the Data Conversion area, select Object.
Making a Direct Connection by Writing a Script
To make a direct connection using a script, you need to call the Connect method. The following procedure shows you how to make a direct animation from an object to a data source on the Click event of a toolbar button in the configuration environment.
NOTE: For OPC data sources you need to remove any character, such as single quotes, that is not part of the valid server address syntax. For example: "ServerName.'Device:MyAddress'" should change to "ServerName.Device:MyAddress" after you remove the single quotes.
To make a direction connection using
a script:
- Insert a rectangle into a picture and name it MyRect. Right-click the rectangle and select Edit Script to make MyRect available to the Visual Basic Editor.
- Create a new toolbar and add a button named DirectConnect. See the Understanding Toolbars section of the Understanding iFIX manual for more information on creating toolbars and adding toolbar buttons.
- Add the following code to the toolbar button's Click event:
Private Sub DirectConnect_Click( )
Dim lStatus as Long
MyRect.Connect("Horizontal Position", _
"FIX32.NODE.AI1.F_CV", lStatus)
End Sub
- Close the Visual Basic Editor.
- Click the DirectConnect button and switch to the run-time environment. The horizontal position of MyRect is now driven by the tag FIX32.NODE.AI1.F_CV.