07-12-2010 07:10 PM
Title says it all.
I want to execute a callback for a Command Button programatically. How is this possible?
Solved! Go to Solution.
07-12-2010 11:18 PM
Hi,
this is pretty straightforward: you call the callback function...
For example, if it is defined as int CVICALLBACK QuitCallback ( int panel, int control, int event,void *callbackData, int eventData1,int eventData2 )
you can call the function as QuitCallback ( panel, control, event,callbackData, eventData1,eventData2 ) where you have to use the appropriate panel and control ID. For event, you may provide the type of event you wish to simulate, e.g. EVENT_COMMIT. If you do not need callbackData, eventData1, eventData2 you may specifiy zeros. In summary:
QuitCallback ( panel_ID, control_ID, EVENT_COMMIT, 0, 0, 0 );
Wolfgang
07-13-2010 02:41 AM - edited 07-13-2010 02:44 AM
Wolfgang answer is the most direct and indeed it works. Nevertheless, there can be different approaches that has been discussed severl times in this board. I can point you to this discussion and this one that offers alternatives to direct calling of the function.
Additionally, as a minor correction to Wolfgang's words, please note both in direct callback calling and if using CallCtrlCallback () you must pass the panel handle to the function, not the panel ID.
07-13-2010 02:48 AM
Hi Roberto,
initially I was wondering about your phrase that the suggested solution indeed works... - until I discovered that indeed you have found a noteworthy correction...
Thanks.