LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Key Down event doesn't fire while control key is held down

Solved!
Go to solution

It occurs to me that a hybrid between my two approaches can work without invoking any menu functions. I can use the application Key Down event, per avogadro5, and check if any of my registered controls are active, as in my user menu example. Let me try...

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 11 of 18
(199 Views)

I've attached a version that does what I wanted to do without invoking any menu functions. Check it out!

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 12 of 18
(190 Views)

@littlesphaeroid wrote:

Zou's example VI does work work (thank you!), but fails if you register for an event for a specific control, which is what I need to do. 

 

The documentation says:

 

Generated on a control that has keyboard focus. If a key press matches a keyboard shortcut in the VI menu, such as Ctrl-C or Ctrl-V, LabVIEW does not generate a Key Down event, regardless of whether the menu item is enabled.

 

I don't see how this behavior is consistent with the application Key Down event Zou shows, but here we are.


I don't know what you mean.  I can't open your VI as I'm using LabVIEW 2018.

I'm not using key down event.  I'm using the Menu Selection instead.

This method works great if you only need to catch a few key combinations.  May not be the best solution if you want to catch all the key down events.

 

But you have to use a customized menu anyway in order to use the key down event for Ctrl+A, C, V...

 

As I mentioned in my first reply, the menu bar doesn't have to be visible.  Works ok if menu bar is hidden.

 

George Zou
0 Kudos
Message 13 of 18
(184 Views)

@littlesphaeroid wrote:

I've attached a version that does what I wanted to do without invoking any menu functions. Check it out!


There's also a "FocusObj" with the event data:

avogadro5_1-1733257863009.png

 

0 Kudos
Message 14 of 18
(177 Views)

Sorry zou, I meant to say that avagaro5's example VI works.

 

I have found a solution that uses events and does not need to mess with menus. The issue with the menu-based solution is that sometimes you actually want to show and use manus, and the menu method is not pretty enough in that case, unless you hide them in a submenu somewhere.

 

I'm attaching my solutions in LV 2018 here.

 

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 15 of 18
(158 Views)

@avogadro5 wrote:

@littlesphaeroid wrote:

I've attached a version that does what I wanted to do without invoking any menu functions. Check it out!


There's also a "FocusObj" with the event data:

avogadro5_1-1733257863009.png

 


This is very interesting, and I didn't know what that was before. Thank you!

 

This would be great for allowing the select all shortcut to be applied to all strings. I can see how this could be extended to other data types as well.

 

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 16 of 18
(156 Views)

There are many ways to skin a cat. I've attached a new version that includes an implementation that works for all strings on the FP. 

 

 

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 17 of 18
(148 Views)

I have requested ctrl-a be implemented in all text LabVIEW fields in the idea exchange. Go vote for it!

 

https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Make-text-entry-in-all-controls-and-indicators-respon...

_____________
Creator of the BundleMagic plugin for LabVIEW!
Message 18 of 18
(114 Views)