LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Menu Items Do Not Appear

Solved!
Go to solution

Using LV 8.5, I want to change the menu bar of my VI programmatically.  I am not using Edit >> Run-time Menu...

 

I've deleted almost all the default menu items ("File", "Edit", etc.) except "Help", then inserted my own "Config" menu.

In the IDE it works great; when I make an executable my menu does not appear.  Instead, the default items

I deleted are indeed gone and the only item showing is "Help".

 

What am I doing wrong?  I've looked at the posts where it says to add an item name and item tag and I've looked at all the

LV examples for adding a menu.  Things are fine until I build the executable and then my little menu item just doesn't show up.

 

There's no reason why I could not use Edit >> Run-time Menu... but I figured I could do it programmatically.  Just trying to figure out what is causing my menu to not appear.

0 Kudos
Message 1 of 8
(5,319 Views)
I would first verify that a shipping example works correctly when built into an application. There's a shipping example called "Dynamic Insert Demo" that creates a menu programmatically. Build this into an app and see if the menu shows up. If it does, then it's clearly something you are doing in your code. As for what, if anything, you might be doing wrong, you will need to show us the code.
0 Kudos
Message 2 of 8
(5,295 Views)

Yeah, that was a good idea.  I added that VI to my build path and created a standalone exe.  It seems to work, so that leaves my code.

 

Attached is a screenshot of the menu insertion sequence.  It's the very first thing in my program.  In a later sequence, I use an event structure to detect "Menu Selection (User)".

 

I've also played with File >> VI Properties >> Screen Appearance.  I've attached a screenshot of that, too.

Download All
0 Kudos
Message 3 of 8
(5,290 Views)

The demo VI has the entire menu bar erased then a few items are added back in.  In my code, I chose to erase most of the menu items but not all, so as a test I deleted all the menu items and now it shows my custom menu item after I build and then launch the exe.

0 Kudos
Message 4 of 8
(5,283 Views)
Solution
Accepted by topic author SashaBC
Now that I see your code it makes sense. The reason why it doesn't work the way you had it before is that you are actually getting an error when you run the application. The error is because not all of those menus actually exist in the run-time environment. Thus, the Delete Menu Items function generates an error, and the rest of the code gets bypassed. The example simply deletes all the menus, and no error gets generated, since only the menus that actually exist get deleted.
Message 5 of 8
(5,271 Views)

I added Simple Error Handler.vi to the error bus of the chain and now I see "Error 1162 -> Labview: Cannot find one or more tags."  This error does not appear when I'm in the Labview IDE.

 

Dude, thanks for this great debug, but can you give me a clue as to how to add my custom menu and keep the "Help" application menu?  Since I did not see an error in the IDE I "assumed" Labview was happy.

 

When it comes to system I/O is it a good idea to assume simulation will not work in the IDE?

 

0 Kudos
Message 6 of 8
(5,266 Views)

Hi Sasha,

 

simply check the error cluster once in a while Smiley Wink And never rely on "It works for my IDE, so it will work always and ever."!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 8
(5,264 Views)

Yet another good tip -- will make error handling more visible in the future.

 

I did find it.  Apparently, one of the tags I'm removing exists in the IDE but not in the runtime menu:  "Project".  Apparently, after this it just stopped processing menu bar code.

 

I do appreciate the help.

0 Kudos
Message 8 of 8
(5,259 Views)