12-03-2024 01:58 PM - edited 12-03-2024 02:05 PM
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...
12-03-2024 02:19 PM
I've attached a version that does what I wanted to do without invoking any menu functions. Check it out!
12-03-2024 02:21 PM
@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.
12-03-2024 02:31 PM
@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:
12-03-2024 03:06 PM
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.
12-03-2024 03:10 PM
@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:
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.
12-03-2024 03:20 PM - edited 12-03-2024 03:21 PM
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.
12-04-2024 12:56 PM
I have requested ctrl-a be implemented in all text LabVIEW fields in the idea exchange. Go vote for it!