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.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Clear keyboard buffer

Hi,

 

I have a very simple vi which i`m trying to detect when the left control button on the keyboard has been pressed. What i find is when the laptop is locked using the windows button + L the L and WIN remain in the buffer until they have been pressed in turn. 


Is there anyway to clear this buffer after a key has been read? 

 

JumpingKangaroo_0-1620766021670.png

 

Thanks


James

0 Kudos
Message 1 of 5
(1,182 Views)

Hi James,

 

which subVI are you using in that image? I don't recognize that icon…

Mind to attach your VI(s)?

 

Have you tried to use an event structure to detect keypress events?

Example:

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 5
(1,121 Views)

@GerdW wrote:

which subVI are you using in that image? I don't recognize that icon…

Mind to attach your VI(s)?


My guess the subVI is this instance of the polymorphic "acquire input data".

0 Kudos
Message 3 of 5
(1,102 Views)

Hi,

 

I`m using the acquire input device.vi. This is used in a larger vi to copy text from a front panel but it is an old program which was wrote using loops and is too much trouble to update. 

 

Thanks

0 Kudos
Message 4 of 5
(1,076 Views)

Hi Kangaroo,

 


@JumpingKangaroo wrote:

This is used in a larger vi to copy text from a front panel but it is an old program which was wrote using loops and is too much trouble to update. 


You need to acquire keyboard data to "copy text from a front panel"? I guess there are better ways to do that…

 


@JumpingKangaroo wrote:
What i find is when the laptop is locked using the windows button + L the L and WIN remain in the buffer until they have been pressed in turn.

I see that too.

I'm guessing this is because your task just sees, when the keys are pressed, but doesn't recognize the release of those keys when Windows intercepts for locking the screen…

 

You might filter the returned array for "LWIN" and "L" items. Or you improve the way how you "copy text from a frontpanel"…

 


@Christian wrote:

My guess the subVI is this instance of the polymorphic "acquire input data".

You're right (as usual)! 😄

 

I just looked into the Connectivity/InputDevices palette, but there only the polymorphic container icon is shown…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 5
(1,061 Views)