06-12-2009 03:07 PM
Solved! Go to Solution.
06-13-2009 04:49 AM
Hi,
you can accomplish this using the command
sub_menu_id = NewSubMenu ( menu_bar_handle, menu_item_id );
Prior to this, you have to create a menu using NewMenuItem (); then you would call NewSubMenu (), which only creates a submenu without any entries; these you can create subsequently using NewMenuItem on the sub_menu_id...
Good luck,
Wolfgang
06-13-2009 05:56 AM - edited 06-13-2009 05:57 AM
Actually you need to call both functions.
NewMenuItem just creates a "place holder" at a given location for your menu item. You specify the location using the MenuID and BeforeMenuItemID parameters.
This function will return a menu item ID.
Then you will use this ID when calling NewSubMenu.
If you want to do it in code completely, you should start with NewMenuBar and NewMenu.
If you already have a menu bar from the editor, you can skip this part.
Hope this helps.
06-13-2009 06:15 AM
I don't believe that I explained this correctly. I can make submenus, but when I try to populate items in the submenu using NemMenuItem, I can't do this successfully. I've tried doing all of these suggestions, and to no avail, this stuff doesn't work. Put down some example source code for the folowing example if it's so easy.
menu
-submenu
--submenuitem
How is this constructed via source?
06-13-2009 12:11 PM - edited 06-13-2009 12:12 PM
Hi Chris,
You can paste the code below directly to interactive execution window and run.
The outcome is in the attachment.
#include <userint.h>
static int pnl,mbar,menu;
static int mitem, subm, submitem;
pnl = NewPanel (0, "", 250, 250, 250, 250);
mbar = NewMenuBar (pnl);
menu = NewMenu (mbar, "menu", -1);
mitem = NewMenuItem (mbar, menu, "submenu", -1, 0, 0, 0);
subm = NewSubMenu (mbar, mitem);
submitem = NewMenuItem (mbar, subm, "submenuitem", -1, 0, 0, 0);
DisplayPanel (pnl);
RunUserInterface ();
I hope this is what you have been asking.
Have a nice weekend
06-15-2009 08:36 AM
You are the man! Exactly what I needed. I was using the wrong value for the second argument of the NewMenuItem(...) function. Instead of using the handler, I was using the constant that is generated in the *.uir header file. Regardless, I recommend that these types of explanations be put into the help files within the CVI environment. There is very little explanation of how to develop submenu items. Nonetheless, I appreciate all of your support via these forums. NI is very instructive and helpful. I recommend this forum to all NI users. Thank you.
Chris