LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Menu Reference for a VI other than the current one

Is there any way to get a Menu reference for a VI that isn't the current VI? There's Current VI's Menubar, but that only works on the current VI. I'd like something that does the same thing, but accepts a VI reference to a higher-level VI. I would expect to find a Property Node entry for it, but there doesn't seem to be one. This is for 8.2.
0 Kudos
Message 1 of 10
(5,517 Views)
I don't think there's a property (but I agree it would be useful sometimes).
If you want to access the menubar refnum for a VI I think you have to pass it as an argument or store it somewhere (indicator, LV 2 style global, global, ...) where you can access it from the other VI.

Daniel


Message 2 of 10
(5,509 Views)


dan_u wrote:
I don't think there's a property (but I agree it would be useful sometimes).
If you want to access the menubar refnum for a VI I think you have to pass it as an argument or store it somewhere (indicator, LV 2 style global, global, ...) where you can access it from the other VI.

Daniel





This is not right.
You can store the Menu Reference to a global variable for example, and you can read it, in any vi you want, just like all variables.
Note: Do not try to use a property note. Use the menu functions
0 Kudos
Message 3 of 10
(5,507 Views)
Ahm, sorry, did I say something different?
0 Kudos
Message 4 of 10
(5,505 Views)
My mistake!
I misunderstood...
I was reading too fast.
0 Kudos
Message 5 of 10
(5,502 Views)
I know I should write in shorter and clearer sentences. Would make it easier to read, especially when reading fast.
Thanks for reminding me of that. My English might have some German structure Smiley Wink

Smiley Happy
0 Kudos
Message 6 of 10
(5,496 Views)

@dan_u wrote:
I don't think there's a property (but I agree it would be useful sometimes).
If you want to access the menubar refnum for a VI I think you have to pass it as an argument or store it somewhere (indicator, LV 2 style global, global, ...) where you can access it from the other VI.


A functional global is what I wound up using. It just seems odd to me that there's no other way to get access to that reference.

It also seems counter-intuitive to me that a Shortcut Menu reference is only valid inside that particular frame of the Event Structure that caught it. If you're using a producer-consumer architecture, you can not send that refnum off to the consumer loop for handling; it can only used within that frame of the Event Structure.
0 Kudos
Message 7 of 10
(5,463 Views)


eaolson wrote:
 
A functional global is what I wound up using. It just seems odd to me that there's no other way to get access to that reference.

It also seems counter-intuitive to me that a Shortcut Menu reference is only valid inside that particular frame of the Event Structure that caught it. If you're using a producer-consumer architecture, you can not send that refnum off to the consumer loop for handling; it can only used within that frame of the Event Structure.



I am not sure what you mean. The refnum seems to be accessible from everywhere .
As i wrote above:
You can store the Menu Reference to a global variable for example, and you can read it, in any vi you want, just like all variables.
Note: Do not try to use a property note. Use the menu functions
0 Kudos
Message 8 of 10
(5,447 Views)


@Pnt wrote:

I am not sure what you mean. The refnum seems to be accessible from everywhere .
As i wrote above:
You can store the Menu Reference to a global variable for example, and you can read it, in any vi you want, just like all variables.
Note: Do not try to use a property note. Use the menu functions



Sorry, that was a little unclear. Yes, the menu refnum you get from Current VI's Menubar is usable anywhere. I was just pointing out some additional oddity about the Shortcut Menu refnum (what you get when you right-click on a control while the VI is running). Namely that if you pass that refnum out of the event loop, via a queue for example, you get error 1160, "Illegal menu."
0 Kudos
Message 9 of 10
(5,434 Views)
Still the case in 8.6. The menu reference is only available and useful in the Activation? event frame.
Doug Ferguson

www.southerndaqsolutions.com
0 Kudos
Message 10 of 10
(5,050 Views)