LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

CVICALLBACK function

In CVI 7.1, I placed a button in my panel, and generated a callback function from there. In the callback function, the last line is "return 0;", and if I left-clicked the button, I got at least two events: EVENT_COMMIT and EVENT_LEFT_CLICK. Ok, everything is fine, until...
I changed the last line to "return (1);". Then if I left-clicked the button, I only got EVENT_LEFT_CLICK, not EVENT_COMMIT any more.
WHY???????

Jason
0 Kudos
Message 1 of 2
(3,230 Views)
Returning 1 from a callback swallows the event. When the event is swallowed, mouse clicks and keypresses are ignored. There are any number of reasons to intentionally swallow the event, but for normal processing, your callbacks must always return 0.
See the online help for Swallow.
Message 2 of 2
(3,230 Views)