CNiBinding
From CNi
| CNiBinding |
| Class |
Declared in: NiBinding.h |
Overview
CNiBinding encapsulates the interface to a single binding object of a button, graph, knob, numeric edit, or slide control. This allows you bind a control property to a data source, such as an item on an OPC or DataSocket Server.
You can use this object to automatically associate a property with a data item. For example, if you want a slide to always display the value of the data item "wave" from a DataSocket Server, you set up a binding to connect the CNiSlide::Value property to "dstp://localhost/wave".
Notes:
- You can bind any control property, not just the value. For example, you can bind the graph background color to an item on an OPC Server.
- You also can manipulate the data values in the CWBindingOnDataUpdated event on each control, so that you can scale the values being sent or received from the property values.
- For a complete list of a control's bindable properties, refer to the Bindings property page for that control.
- You must call CNiBinding::SetBindObject in the same thread that you used to create the object to which you are binding.
- Currently, data binding is not supported on the 3D graph control.
- You must initialize a CNiBinding object from an existing object. If you do not initialize a CNiBinding object from an existing object, a CNiObjectNotInUsableState exception will be thrown when you attempt to manipulate the instance of the CNiBinding.
Base Classes
Data Items
| AccessModes | AccessMode | Specifies the access mode for the connection. | |
| CString | ActualURL | Identifies the actual URL of the current data source or data target. | |
| CString | BindProperty | The name of the property to bind to a data source or data target. | |
| bool | DataUpdated | Specifies if the CNiBinding object's data value or attributes have been set since they were last read or written. | |
| bool | DataUpdatedEnabled | Specifies if the binding should generate the DataUpdated event whenever the binding data changes. | |
| long | LastError | The last error code used in the StatusUpdated event. | |
| CString | LastMessage | The last message used in the StatusUpdated event. | |
| ConnectionStatus | Status | The current status of the CNiBinding connection. | |
| bool | StatusUpdated | The CNiBinding object calls this function when its Status property is updated. | |
| long | TimerInterval | Use this property to configure CNiBinding to automatically call Update at regular intervals. | |
| CString | Url | Specifies the data source or target. |
Constructors
| Default constructor. | |||
CNiBinding( CWBinding_CI* pCustom, CNiInterface::ThreadAccess option ) |
Constructor that attaches to the specified CWBinding_CI pointer. | ||
CNiBinding( const CNiBinding& source ) |
Copy constructor. |
Destructors
Functions
| void | Connect( LPCTSTR URL, AccessModes accessMode ) |
Connects the CNiBinding object to a data source or target. | |
| void | Connect() |
Connects the CNiBinding object to a data source or target. | |
| void | Disconnect the binding connection from the source to which it is currently connected. | ||
| static const IID & | GetIid() |
Returns the globally unique identifier (GUID) of the ActiveX interface to which this class connects. | |
| const CNiBinding & | Assignment operator. | ||
| bool | SelectURL( const CString& startURL = "", const CString& title = "", int options = 0, const CString& filter = "" ) |
Displays a dialog box for the user to select a data source/target and sets the URL property to that data item. | |
| void | SetBindObject( CNiInterface& subObject ) |
Sets the object whose property binds to a data source. | |
| void | SetBindObject( CNiControl& control ) |
Sets the object whose property binds to a data source. | |
| void | Update() |
Causes the CNiBinding object to read from a data source or write to a data target. |