LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to execute callback functions progamatically

Solved!
Go to solution

Title says it all.

 

I want to execute a callback for a Command Button programatically. How is this possible?

0 Kudos
Message 1 of 4
(4,214 Views)
Solution
Accepted by topic author ArashE

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

0 Kudos
Message 2 of 4
(4,206 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 3 of 4
(4,195 Views)

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...Smiley Wink Thanks. 

0 Kudos
Message 4 of 4
(4,189 Views)