LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I stop an event structure detecting keydown events until the vi has initialised?

My application has a sequence structure with 3 frames. First one initialises some front pane objects and controls, the second communicates with an external device via a serial port to a start condition and waits for this to complete by polling the device. The third contains the event structure which reads the device when the spacebar is pressed. The problem is that any pressing of the spacebar when the application is in the first 2 frames of the secquence structure is stored and executed as soon as the third frame becomes active. I have tried using dynamic Event registration but to no avail. Am I doing something wrong? can the keyboard be disabled until the second frame complete
s?
0 Kudos
Message 1 of 3
(2,883 Views)
I usually avoid sequence structures in favor of driving execution order through data dependency (error clusters are great for that). However, since you've already got one, you coul try to add another frame right before your event structure. In that frame, place another event structure that can trap that stray keyboard event. Put a tiny timeout value on it so it doesn't appear to "pause" your VI's response. That event structure will catch any bogus key presses that happen during initialization.

Having said all that, I still think the behavior is not proper. The event should not be handled if it happened before your VI gets to the event structure. For now, you can try that workaround.

Daniel L. Press
PrimeTest Corp.
www.primetest.com
0 Kudos
Message 2 of 3
(2,883 Views)
Thanks for that I will give it a try!

The event is not handled until the vi gets to the event structure but any keypresses during initialsation seem to be saved up and processed immediately once the event structure is reached.
0 Kudos
Message 3 of 3
(2,883 Views)