mrmclovin
01-04-2009 19:32:05
Hello!
I can't figure out how to create a menubar with items in the LayoutEditor. If I create a MenuBar and add an item called 'Settings', the MenuBar is still empty. What am I doing wrong?
(The MenuBar is the widget that the Layouteditor uses for the menu, right?)
BTW. The LayoutEditor crashes if I add a MenuBar Item and then delete it from the list! Bug?
mrmclovin
25-06-2009 18:52:49
Bump. I really need a menu bar. I doubt it's not possible since the layout editor has one?
hello,
I have problem making menubar from code too and the only piece of code that manage menubar in the layout editor doesn't help. The lack of explicit documentation is reeeally frustrating. I spent a lot of time with this.
so let try to write a working piece of code here
// create an empty menu bar
MyGUI::MenuBar * a_pMenuBar = a_pGui->createWidget<MyGUI::MenuBar>("MenuBar", 0, 0, a_pGui->getViewWidth(), 25, MyGUI::Align::Default, "Overlapped");
// add the "File" menu item (this is a button)
MyGUI::MenuItem * a_pFileItem = a_pMenuBar->addItem("File", MyGUI::MenuItemType::Popup);
// add a PopupMenu (which is a MenuCtrl) to the MenuItem (only one MenuCtrl per MenuItem)
MyGUI::PopupMenu * a_pPopupMenu = a_pFileItem->createItemChildT<MyGUI::PopupMenu>();
// add MenuItems to the PopupMenu
a_pPopupMenu->addItem("Open");
a_pPopupMenu->addItem("",MyGUI::MenuItemType::Separator);
a_pPopupMenu->addItem("Quit");
can someone explain to me why i can't see a popup opening when i move the cursor on the "File" button.
thx
Ok, actually the code work but i missed that i had to call
m_pGUI->injectFrameEntered(frametime);
each frame.
mrmclovin
24-01-2010 13:32:34
I've also had problems to understand this .. and all parts with menitem, menubar, menuctrl is sp confusing. I've proposed an suggestion for combining everything to just MenuItem which can have arbitrary children etc so it would be like this:
menuItem* file = menubar->addItem("File");
MenuItem* save = file->addItem("Save")
save->addItem("Save to CD..")
save->addItem("Save to file")
...etc.. much easier