LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with event processing for boolean key navigation in LV 2009?

Hello fellow Experts!

 

See the attached "Serial Number" vi

 

Key navigation is set to "Return" for the OK key.   If you click the OK key, the SN indicator reads the value that is entered into the SN control

If you press Enter, the event is processed , but the control value is not read.

 

However, if you run again, and press enter again, the previous control value is read?   I have tried placing the SN control outside the Event stucture, so that it would run after the Event loop finished execution, but that behaves the same.

 

This was tested using LV 2009 SP1 (I dont have an older version available now, but the attached file is saved for LV 😎

 

Any thoughts are appreciated

 

Regards

0 Kudos
Message 1 of 2
(2,534 Views)
This is happening because the value is not being committed to the string when you press Enter...i.e., the text is still being edited when Enter is pressed.  As the code is written, you want Enter to do two things at once...commit the string, and toggle the button.  Unfortunately, the button is going to take precedence since you've explicitly indicated what you want to happen when Enter is pressed.  The easiest way to fix this would be to select "Update Value While Typing" in the right-click menu for the string control.  This way, the value will update every time a character is typed, so when Enter is pressed, the latest value that was typed in the string has already committed its value.
Message 2 of 2
(2,532 Views)