06-19-2009 07:25 AM
Dear NI,
I have some code that I want to change the fuctionality of toggle buttons (depending on various scenarios). However, if I programmably set the Control Mode of the button to either VAL_INDICATOR or VAL_NORMAL the callback function for that button ceases to be called when the button is pressed.
Is this the defined behaviour?
I'm using CVI 8.0.1(356)
Regards,
Brian
Solved! Go to Solution.
06-19-2009 08:32 AM
06-19-2009 08:37 AM
The callback functions are still called, but the events for indicator, normal and hot modes of a control will vary. For example, all modes will receive an EVENT_LEFT_CLICK, but only Hot controls receive the EVENT_COMMIT tag.
JR
06-19-2009 08:53 AM
Ah yes I see that you are correct, the event_commit switch in the callback is only true if the control is hot. So if you are switching your control back to "normal" you should instead be switching to "hot" which will use the event_commit in your callback, as another note I made a small app to check that if I switch a button to indicator then back to hot it will work properly incase that was also your problem.
Hope this fixes your problem! And thanks jr
06-22-2009 03:22 AM
Yep the VAL_HOT did the trick.
A big thank you to dsappet and jr_2005 for taking the time to investigate this.
Much appreciated!
Regards,
Brian