05-25-2009 01:23 PM
Hi.
I want to send extra flag information when calling a CallCtrlCallback(,,,eventData1,eventData2,).
When pressing the buttons on the panel the debug window shows that these are not used (default value is 0).
Can eventData1 and eventData2 be freely used?
Thanks.
05-25-2009 03:41 PM
EventData parameters should not be considered freely available to the programmer: they hold some useful values that you must be aware of so that you can use them when needed. As an example, EventData parameters show the mouse X/Y positions on all click events. In userint.h, where individual events are defined, you can find the value passed in EventData parameters on each event.
If you want to pass user defined values to a control or a panel callback yo can use CallbackData instead: this parameter is gauranteed to never be used by the IDE and is provided exactly as a way of passing user-defined data to a callback. When using CallCtrlCallback CallbackData is not part of the function prototye, so you may need to store the desired value on the control by means of SetCtrlAttribute (panel, control, ATTR_CALLBACK_DATA, (void *)myData); inside the callback you must cast the value passed to the appropriate data type before using it.
05-25-2009 04:46 PM
Hi Roberto.
Your information is what I needed to do.
Thanks.
One more question:
When using the panel to press the buttons (On/Off in this case) the callback automatically knows the state to put the button in and changes the color etc.
However, if I call the CallCtrlCallback() in my code it does not change the state (or color) of the button. Is this expected?
I can get around this by setting the value before calling CallCtrlCallback():
/* Turn on the SYS-RESET button */
SetCtrlVal (panelMain, PANEL_MAIN_SYSRESET, 1);
result = CallCtrlCallback (panelMain, PANEL_MAIN_SYSRESET, EVENT_COMMIT, eventData1, eventData2, &returnValue);
Is this the prefered way to do it?
Thanks.
05-25-2009 11:47 PM