08-12-2007 06:19 AM
08-13-2007 12:21 AM
Hi,
I assume you wanted to write SetCtrlVal (not GetCtrlVal).
You can call your callback function with appropriate parameters from anywhere in your code like an ordinary C funtion.
So after you change the position of your switch within your code call the callback function with the event parameter set to EVENT_VAL_CHANGED, and be sure you handle this event in your callback.
Hope this helps,
08-13-2007 07:33 AM
08-13-2007 09:08 AM
Hi ~,
Just replace the line with the one below in your Stop callback function.
TurnOnLed2(panelHandle,PANEL_LED_2,EVENT_VAL_CHANGED,NULL,0,0);
But I still cannot quite understand why you need that. You can simply write
SetCtrlVal(panelHandle,PANEL_LED_2,1);
in the Stop callback.
Anyway, in case you need it, that's the way it works 🙂
Hope this helps,
08-14-2007 06:11 AM
Functions in the User Interface, DDE Support, TCP Support, RS-232, DataSocket, Utility, and ActiveX Libraries provide callbackData, eventCallbackData, and threadFunctionData parameters for user-defined data. These parameters are 4-byte values passed by the library to the callback function.
You can use these parameters as pointers to data objects that you need to access in the callback function. This way, you can avoid declaring the data object as a global variable. In the User Interface Library, for example, this means that conceptually the panel or control that is associated with the callbacks has ownership of the data object.
So I suppose that , in a simple CtrlCallBack like this one , there are no data objects at all ,and we call pass NULL , is that true?08-14-2007 08:53 AM
Hi ~,
The purpose of the callbackData pointer is as you have written, to pass a parameter to the callback by reference (as a pointer).
That's all. If you need such a data in your callback, you can use it, otherwise it can be safely set to NULL which is a valid pointer that points to nowhere.
eventData1 and eventData2 provide extra information about the event. For example, when you click on a control in the UIR these values become the mouse coordinates at the instant you clicked. panel and control are set to correct values when you operate the control from the UIR during execution but you call the callback "manually" you are free to assign any value.