LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Button Control Mode loses callback function

Solved!
Go to solution

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

0 Kudos
Message 1 of 5
(5,440 Views)
If you set the button to be an indicator then it will not allow you to activate the callback however I do believe if you change the control value back to hot than you should be able to use it again, I can check on mine quickly if that is correct and make another quick post.
Douglas Sappet
Test Hardware Development Engineer
Allegro Microsystems Inc.
Manchester, NH
Message 2 of 5
(5,436 Views)

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

Message 3 of 5
(5,433 Views)

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

Douglas Sappet
Test Hardware Development Engineer
Allegro Microsystems Inc.
Manchester, NH
Message 4 of 5
(5,431 Views)
Solution
Accepted by topic author BrianM

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

0 Kudos
Message 5 of 5
(5,399 Views)