LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Clear the Keyboard keys (space, enter) effect in panel callback for generating last pressed button callback.

I am using LabWindows/CVI Version 6.0. In my program there is a panel which have a text box and buttons. One of them is clear text box. I have implemented �panel callback function� and �callback function� for the Clear button. In the �panel callback function� there is switch and different case handling. The last is the keypress handling for jumping to different position(line) inside the text box and for continue the file reading into the text box. If I press the Clear button (or any other) my program continuously indicate the Clear button callback (or any other) if I press a keyboard �space� or �Enter� key. How can I avoid this effect, or I have to use in my �panel c
allback function� other keyboard keys to react on my action? How possible to clear in the �panel callback function� the activation of the last pressed button callback function, because the �panel callback function� will be activated first?
0 Kudos
Message 1 of 7
(3,077 Views)
Pushing Space and enter generate event commit callbacks for the currently selected active gui component, so if your list is a display only list clicking on it will not make it active, so you might want to progamaticaaly set that to the current active component and only then process the key strokes like enter end space.

use setactivecontrol (I think)
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 2 of 7
(3,077 Views)
Thank you for the advise, I have use it, and this solution works fine.
But I am wondering, is there any possibility to clear (in the panel callback) the effect, generate event commit callback.
0 Kudos
Message 3 of 7
(3,077 Views)
Yes, remove the event commit option from the control callback and use one of the other, like event_val_chane or add keypressed handling as a subfuction of the event commit case.
Jattie van der Linde
Engineering Manager, Software & Automation
TEL Magnetic Solutions Ltd
0 Kudos
Message 4 of 7
(3,077 Views)
In any callback you can "swallow" the event. All you need to do is return from the callback a non-zero value and the rest of the controls won't receive the callback.

for example: the user clicks in a control, the control's callback executes and returns a non-zero value; then the panel callback will not be executed and the control will not receive the messages.

I hope this helps.

Juan Carlos
N.I.
0 Kudos
Message 5 of 7
(3,077 Views)
Juan, thank you for the correct solution to swallow the event. This is that what I wanted to make.
0 Kudos
Message 6 of 7
(3,076 Views)
I'm glad to help!

Juan Carlos.
0 Kudos
Message 7 of 7
(3,075 Views)