LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Curious callback problem

This is a tiny test program, designed to call one of several callback functions when a radio button is pressed. It works exactly as advertised, except the first time a button is pressed, when it doesn't respond. When the button is pressed again, off it goes. What's going on here?
0 Kudos
Message 1 of 4
(3,236 Views)
That's easy to understand:
You call ChainCtrlCallback() when the button is pressed for the first time,
so your ButtonXCallback is chained not until the first COMMIT event occurs.
The result is, that the chained callback is called beginning from the second
event.

To solve this, you have to chain all the ButtonXCallbacks at the beginning
of your program (before RunUserInterface()). I have modified your project
with that and now it works fine. See attached archive.

Regards Torsten

"NoVIsonme" schrieb im Newsbeitrag
news:506500000008000000CE310000-1005954886000@exchange.ni.com...
> This is a tiny test program, designed to call one of several callback
> functions when a radio button is pressed. It works exactly as
> advertised, except the fi
rst time a button is pressed, when it doesn't
> respond. When the button is pressed again, off it goes. What's going
> on here?
Message 2 of 4
(3,236 Views)
Thanks Torsten - I was really puzzled by that. I'm not that used to callback chaining, hence the test prog.
0 Kudos
Message 3 of 4
(3,236 Views)
Hmm... On reflection, I think I was guilty of some very woolly thinking there. In effect, my prog wasn't trying to chain the callbacks, more just to call them. Is there an advantage of one approach to the other? Of course, if I'd got the chain right the first time, I'd have been spared the joy of working out how to declare pointers to callback functions 🙂
0 Kudos
Message 4 of 4
(3,236 Views)