dpConnectExtUserData()
Calls a callback function on data change of the defined data point values/attributes and passes them to it. In contrast to dpConnectExt(), this function also allows you to pass any data to the callback function.
Synopsis
int dpConnectExtUserData([class object,] string|function_ptr work, anytype
userData, [bool answer,] dyn_string dpConn, dyn_string dpExt);
Parameters
Parameter | Description |
---|---|
object | An object of a Control++ class. |
work |
Name of the callback function ("work function") that is called when data point values change. Or The name of a function pointer to the work function (callback function). |
userData | User-defined data that is passed as a parameter to the callback function. |
answer | Specifies whether the callback function should be executed when dpConnectExtUserData() is called or only after a value change. The default value is TRUE (the first callback is executed when dpConnectExtUserData() is called) |
dpConn | List of the data points whose value change trigger the work (callback) function. |
dpExt |
List of the extended data points whose value change does not trigger the work function (callback) |
Return Value
The function dpConnectExtUserData() returns 0 and in the event of a failure it returns -1.
Error
Use the function getLastError() to retrieve errors. The function throwError() can be used to write an error message to the PVSS_II.log log file.
Description
Calls a callback function when the defined data point values/attributes in the trigger list change and passes them to this function. In contrast to dpConnectExt(), this function also allows any data to be passed to the callback function. This callback function (also called work function) is automatically executed each time some of the registered trigger data point values/attributes change (provided that all elements contained in the function call are passed).
The DP attribute _status only calls the callback function if the status has changed. The behavior differs from the _value attribute, where the callback function is called for every value input (regardless of whether the value has changed or not).
When dpConnectExtUserData() is called, the callback function is immediately executed once with the current data point values if the answer argument is not set to "false". If a specified attribute is changed during the execution of the callback function, the next call of the callback function is not executed until the previous call has been completed. The registration (function is called when values are changed) is valid until the dpConnectExtUserData() function stops the registration, the manager executing it is stopped or the panel in the user interface is closed.
If a value of a data point element that belongs to the extended list is changed, the callback function is not triggered.
If the list of trigger data point elements is empty, an error is raised.
For an example, see chapter dpConnectExt().
Example of a callback function
CCB(dyn_string dsTrigger, dyn_anytype triggerValues,dyn_string dsExt, dyn_anytype extValues)
{
/* Callback function code */
}
Assignment
Data point Functions, Waiting Control Functions, Connection Functions.Connection Functions.
Availability
UI, CTRL