Robert Carlin wrote:> Hey guys,
>
> I have been trying unsuccessfully to create a menu that holds
> "sub-menus". To clarify, I want something along the lines of
when you
> click on a File menu, then see the "New" menu, which you can
click on to
> open a new layer of menus. Is this supported yet in WxRuby?
Yes, but not using plain Menu#append, and not (yet) through the wxPython
method of append_menu. You have to create a MenuItem, and then use
append_item to add it to the menu.
Here is a working fragment, extracted from the minimal.rb, and augmented:
#####
menuFile = Menu.new
helpMenu = Menu.new
helpMenu.append(Minimal_About, "&About...\tF1", "Show
about dialog")
submenu = Menu.new
submenu.append(Minimal_Sub1, "nothing")
submenu.append(Minimal_Sub2, "more nothing")
submenuitem = MenuItem.new(helpMenu, Minimal_Submenu,
"Submenu", "Nice submenu!",
ITEM_NORMAL, submenu)
helpMenu.append_item(submenuitem)
menuFile.append(Minimal_Quit, "E&xit\tAlt-X", "Quit this
program")
menuBar = MenuBar.new
menuBar.append(menuFile, "&File")
menuBar.append(helpMenu, "&Help")
set_menu_bar(menuBar)
#####
Kevin