05-07-2009 02:25 PM
I have a menu ring that when I select a menu item I need to select a sub list of items.
How can this be done?
i.e. Item2 has additional items to choose:
Menu Ring
Item1
Item2
Item3
Item4
Item2 Menu
ItemA
ItemB
ItemC
09-09-2009 10:01 AM
Hi NI Nubie,
If you wanted to do it all in one Menu Ring, you could dynamically repopulate the list items to display the sub options. Not very graceful, as you end up hardcoding the menu items, but it just might do the job.
I've attached a quick example I've knocked up to show you.
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor
09-09-2009 12:32 PM - edited 09-09-2009 12:36 PM
Charlie showed a neat way of doing it, but if you would rather design your menu ring using the UI Editor, you can create a second ring for your Item2 submenu, and edit the control to be Initially Hidden. In your main() function, before you display the panel, move the submenu to the same location as the main menu. You could do this in the UI editor as well, but then you would have to move one to get to the other, and someone else working on your project may not know that there are two controls on top of each other.
In your callback for the main menu, if item 2 is selected, make the main menu invisible and make the submenu visible. In your submenu, include a menu option to Return to main menu. In the submenu callback, if the Return item is selected, make the submenu invisible and make the main menu visible.
I have attached a sample project doing that.
09-10-2009 03:26 AM
A better solution to this question in my opinion is showing a real menu bar (which can hold several nesting levels, if needed) with RunPopupMenu: the menu bar can be loaded at runtime without need for it to be shown on the panel; RunPopupMenu dynamically displays it where the user clicks; the return code from the function can be tested against menu item constants to detect which element the user has selected.
Look at the attached example.
09-10-2009 06:20 AM
Roberto,
Great idea, using the menu bar popup!
I've taken this and adapted my example to store the mouse x,y on left click and call the pop-up when Item 2 is selected.
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor
09-10-2009 06:32 AM
Updated, as I'd posted my development code
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor
09-10-2009 09:37 AM
Updated:
Charlie Rodway | Principal Software Engineer | Certified TestStand Architect (CTA)
Computer Controlled Solutions Ltd | NI Silver Alliance Partner | GDevCon#1 Sponsor
09-16-2009 03:11 PM
Here is another example using a menubar with sub menus and the ring control. Hopefully it is helpful.
09-16-2009 05:04 PM
Hi Roberto.
I like your solution and will use it in the future but for this particulat menu ring I need to display the selction after it is made.
The menu rung displays test selections and then displays the selection while the test runs.
There are 32 selections with one selection requiring the sub-selection feature.
Thanks.
09-16-2009 05:08 PM
Hi Roberto.
On second thought I could put a text control item beside the button and just copy the selected test message to the text control item.