From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

How to programatically set and save shortcut menus in to a control?

I want to create some some shortcut menus for multiple controls of the same type, I want to do it programatically so I dont have to go one by one editing the custom menus, or copy paste the same control since I would have to re-build all my controls every time I want to add a new shortcut menu option (becouse I dont know yet how many options I will need). How can I programatically add a element to the shortcut menu of a control, and save it in to it? For example, in shortcut menu activation event, I can modify add/remove elements, but this do not save on to the shortctu menu you edit statically in edit mode of the vi. Ty! 

0 Kudos
Message 1 of 12
(3,422 Views)

PD: I know that I could just create the menu dinamically every time menu activation event happens, but this would be slower than having it already created on edit mode? 

0 Kudos
Message 2 of 12
(3,418 Views)

Is this function what im looking for? "Set Menu Item Info Function"

0 Kudos
Message 3 of 12
(3,414 Views)
Maybe microscopically slower, but you aren't going to.have a huge menu on a control anyway. And it is much more maintainable.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 4 of 12
(3,374 Views)

Yes Mike, I will create all shortcuts on runtime, time diference is not a factor! Ty!

0 Kudos
Message 5 of 12
(3,339 Views)

Mike, How do you detect when the user does not select an item of the shorcut menu by cliking somewhere else in the screen?

0 Kudos
Message 6 of 12
(3,308 Views)
In that case the menu selection doesn't fire.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 7 of 12
(3,301 Views)

But if you are w8ing in a event structure for it the only chance is to put a timeout so you dont get stuck? When I create the menu I weit for the event rigth after, im triying to avoid timeouts so my while loop only runs when a event happens.

0 Kudos
Message 8 of 12
(3,290 Views)
There is no need for a time out. If someone right clicks on the control with the menu, a menu activation event is fired for that control. If the make a selection a menu selection event is fired for the control, otherwise it is like they never clicked on the control in the first place, nothing happens.

Write a small example for yourself and run it with execution highlighting turned on. You'll see what I mean.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 9 of 12
(3,283 Views)

I think my problem is that im trying to detect the case in a separeted event structure, I detect activation in one event strcuture, then go to a case strcutrue when the shorcut activation fires, and then (inside the case structure and in a separated time structure from the frist that triggered activation for shorcut) I weit for selecction. You mean that if I w8 for the selecction in the same Event structure than the rest of the user interface that wont block my program rigth?

0 Kudos
Message 10 of 12
(3,275 Views)