LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

custom right-click menu shortcut underlined

I'm trying to customize the right-click menu that appears for a tree control.

Mostly it works fine but I would like to add an underline and keyboard shortcut for commonly used items.

 

E.g. So that Edit appears as Edit, and if you press 'e' on the keyboard it fires the shortcut menu selection event for edit.

 

It only seems to work for application menus not right-click menus.

 

Am I missing something or is this a limitation / bug / oversight?

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 1 of 5
(1,499 Views)

Hello Troy,

 

Unfortunatelly, adding an underline in shortcut menu (right-click menu editor) is not yet implemented in LabVIEW 2011, still you can post your idea at Idea Exchange here and our R&D will take a look at your proposal:

http://forums.ni.com/t5/NI-Idea-Exchange/ct-p/ideas

 

But there is a walkaround for implementing keyboard shorcuts for shortcut menu:

 - Create the template Producer/Consumer Design Pattern (Events), and create tree control, who has element "Item" in the shortcut menu

 - Add 2 events cases in the producer loop - Shortcut Menu Selection (user) for a tree control, and Key Down from <This VI>:

 - In Shortcut Menu Selection (user) case you need to enqueue the ItemTag from Event Data Node

 - In Key Down case you need detect the key combination you want to use and enqueue the tag of a item (Item in our case) from shortcut menu you want to call - this will connect keyboard combination with shortcut menu (In Event Data Node you have data Char, which return ASCII code of the pressed key; and PlatMods/Mods cluster, which include pressed modifiers as Ctrl, Alt, Command etc. )

 - In the Consumer loop you need to make a case structure, which decide the action based on the dequeued item

 

If you will have any problems with implementation, or have any other question, feel free to ask.

 

Best Regards,

Gregor Cerne

 

National Instruments

0 Kudos
Message 2 of 5
(1,479 Views)

Hello Gregor,

Thank you for your reply.

Yes I did think about doing it that way but it seems a bit too convoluted.

I also don't like the idea of the Key Down event triggering on every key press.

 

I even started to think if there was some way to dynamically register for a key down event when the right-click menu was activated and then deregister afterwards.

But stopped before going too far down that path because it seemed to convoluted for what should be built in.

 

I think a suggestion in the idea exchange is the only practical option.

 

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 3 of 5
(1,470 Views)

IDEA Exchange: Ability to add keyboard shortcuts to custom right-click context menus

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
Message 4 of 5
(1,465 Views)

nice thought!


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 5
(1,458 Views)