Jump to content

Retrieving the menu refnum of a non-currrent VI


Recommended Posts

Hi Clbst47:

Yes, you can do it. Application control>Menu>Current Vi's Menubar will allow you to put a reference to the current vi's menubar on the block diagram.

On the panel of your Sub-vi, you can insert a control that you can wire up to this reference (Controls>Refnums>Menubar Refnum.)

Then you can put whatever menu control stuff you want inside the sub-vi. Can reduce a bunch of clutter on the Main Vi's diagram. Can also save a lot of work by having the sub-vi used by many callers needing similar menu service. I've used it to great benefit for both.

Easiest shortcut is to start with the menu stuff on the main vi, select what you want to put in the sub-vi (not including the Refnum constant) and then use create sub-vi.

Be careful about trying to do two things at once with a menu-- most cases were this is a bad idea, with unpredictable results. So be sure to always daisy-chain menubar out from one menu operation to the in of the next operation. This might mean that you need a menubar out indicator on your sub-vi. (I think you might be able to save the menubar as Global, but that's a really dangerous idea. :nono: Even those of us that like Globals for some purposes cringe at this & I hate to think how the no-globals-ever-no-matter-why guys would feel about it.

Good luck, hope this helps.

Link to comment
Hi Clbst47:

Yes, you can do it.  Application control>Menu>Current Vi's Menubar will allow you to put a reference to the current vi's menubar on the block diagram. 

On the panel of your Sub-vi, you can insert a control that you can wire up to this reference (Controls>Refnums>Menubar Refnum.)

Then you can put whatever menu control stuff you want inside the sub-vi.    Can reduce a bunch of clutter on the Main Vi's diagram.  Can also save a lot of work by having the sub-vi used by many callers needing similar menu service.  I've used it to great benefit for both. 

Easiest shortcut is to start with the menu stuff on the main vi, select what you want to put in the sub-vi (not including the Refnum constant) and then use create sub-vi.

Be careful about trying to do two things at once with a menu-- most cases were this is a bad idea, with unpredictable results.  So be sure to always daisy-chain menubar out from one menu operation to the in of the next operation.  This might mean that you need a menubar out indicator on your sub-vi. (I think you might be able to save the menubar as Global, but that's a really dangerous idea.  :nono:  Even those of us that like Globals for some  purposes cringe at this & I hate to think how the no-globals-ever-no-matter-why guys would feel about it.

Good luck, hope this helps.

3943[/snapback]

Thanks for the reply - I would really like to be able to do this w/out passing in a menu refnum. Is this possible? I simply can't believe that the menubar is not an exposed property of a VI somewhere!

Link to comment
Thanks for the reply - I would really like to be able to do this w/out passing in a menu refnum.  Is this possible?  I simply can't believe that the menubar is not an exposed property of a VI somewhere!

3944[/snapback]

The menu refnum is not on the VI property list yet. It is on the wish list since 2001. See item 5.1 in the document attached here.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.