From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Get secondary thread to recongnize keyboard input?

Running LabWin/CVI 6.0. Win2000.
Have a simple panel with a textbox. Created another thread and from
this thread I want to be able to know if the operator 'hits' a key on
the keyboard.
0 Kudos
Message 1 of 2
(2,488 Views)
Hello

Any event generated by a control will only be detected in the thread
that created. So only the UI thread ( or the thread that actaully
created the panel of interest in this case) will get any events
generated by the controls on the user. What you can do is use the
thread safe queues that CVI provides. The queues generate callbacks
based on whether the queue size changed etc.. So when the user press a
key, the textbox will generate a keypress event, you can pass this
value to the queue, which in turn will fire the appropriate callback
in your thread.

You can find the queue library under Utility >> MultiThreading >>
Thread Safe queues.

I hope this helps
If i missed the question, let me know

Bilal Durrani
NI
0 Kudos
Message 2 of 2
(2,489 Views)