Hi guys,
just wanted to check if I’ve got this right, I couldn’t find any examples or full code showing how to make a menu and it’s the first time I’m using one.
1) Order of menu sub parts:
So you need a menubar,
To this you can add multiple MenuItems,
To the menuItems you add a PopupMenu via setPopupMenu,
To the PopupMenu you add multiple ItemEntry’s.
This seems to be working so far; is this the correct way to do it?
2) I have another question. I noticed that when you click on a menuitem, it displays its popupMenu and the items, but this popupMenu does not close unless you click on one of the popupMenu items.
I guess what Im after is that when a Menu popupMenu is open and the user clicks elsewhere in the system or moves the mouse away from the menu then this popupmenu should close. Otherwise it just remains open forcing the user to click an item in it to close it.
Ive tried using a MouseLeaves event on the popupmenu, but the mouse leavable area of the popumenu does not take into account its items, so you move the mouse over the popupmenu items and the popupmenu MouseLeaves event is triggered. Not the desired behaviour.
Hmm is there like a focus lost event or something for the popupmenu and all its items? Have I missed something really obvious?
Getting to men-u
Moderators: CEGUI MVP, CEGUI Team
- martignasse
- Just can't stay away
- Posts: 227
- Joined: Thu Apr 14, 2005 08:10
- Location: Lyon, FRANCE
Re: Getting to men-u
sound good to me.So you need a menubar,
To this you can add multiple MenuItems,
To the menuItems you add a PopupMenu via setPopupMenu,
To the PopupMenu you add multiple ItemEntry’s.
This seems to be working so far; is this the correct way to do it?
i'v made a sample project to test that some times ago
(and not yet on the wiki.....shame on me)
basicly, it look like this :
Code: Select all
// create menu bar window
Menubar* menuBar = static_cast<Menubar*>(winMgr.createWindow("WindowsLook/Menubar", "Menubar"));
menuBar->setWindowPosition(UVector2(cegui_reldim(0.0f), cegui_reldim( 0.0f)));
menuBar->setWindowSize(UVector2(cegui_reldim(1.0f), UDim( 0.0f, 30.0f)));
menuBar->setWindowMaxSize(UVector2(cegui_reldim(1.0f), UDim( 0.0f, 30.0f)));
menuBar->setWindowMinSize(UVector2(cegui_reldim(1.0f), UDim( 0.0f, 30.0f)));
d_root->addChildWindow(menuBar);
// create file menu item window
MenuItem* menuFile = static_cast<MenuItem*>(winMgr.createWindow("WindowsLook/MenuItem", "File"));
menuFile->setText("File");
menuBar->addItem(menuFile);
// create file menu popup window
PopupMenu* popupmenuFile = static_cast<PopupMenu*>(winMgr.createWindow("WindowsLook/PopupMenu", "popFile"));
menuFile->setPopupMenu(popupmenuFile);
// create exit popup item window
MenuItem* itemExit = static_cast<MenuItem*>(winMgr.createWindow("WindowsLook/MenuItem", "Exit"));
itemExit->setText("Exit");
popupmenuFile->addItem(itemExit);
yep, i noticed that too.I have another question. I noticed that when you click on a menuitem, it displays its popupMenu and the items, but this popupMenu does not close unless you click on one of the popupMenu items.
you'r guess is mine

- martignasse
- Just can't stay away
- Posts: 227
- Joined: Thu Apr 14, 2005 08:10
- Location: Lyon, FRANCE
Re: Getting to men-u
hehe
and you can find a "in situation" example of menu use in the source code of TestaSkin
sorry, just an egocentric reminder
and you can find a "in situation" example of menu use in the source code of TestaSkin

sorry, just an egocentric reminder

- spannerman
- Home away from home
- Posts: 330
- Joined: Wed Jan 12, 2005 12:06
Re: Getting to men-u
Hehe cool, thanks mate 

Re: Getting to men-u
I have just see my taharezlook and my Windowslook schemes and I have not have any taharezlook/MenuBar or Windowslook/MenuBar. why? i want to test it too
- martignasse
- Just can't stay away
- Posts: 227
- Joined: Thu Apr 14, 2005 08:10
- Location: Lyon, FRANCE
Re: Getting to men-u
Be sure to use at least the 0.4 CEGUI version. and you should use the falagard version of these looks, named "TaharezLookSkin" and "WindowsLookSkin", if i remember correctly.I have just see my taharezlook and my Windowslook schemes and I have not have any taharezlook/MenuBar or Windowslook/MenuBar. why? i want to test it too
Re: Getting to men-u
I dont have them, I use de CEGUI that came with ogre. I have them in the source code downloads of this page. What files I have to copy only the .schemes?
Thanks!
Thanks!
- martignasse
- Just can't stay away
- Posts: 227
- Joined: Thu Apr 14, 2005 08:10
- Location: Lyon, FRANCE
Re: Getting to men-u
you have two possibility :
-compile the 0.4 version and integrate it with orge.
(i can't help you on that, never did before)
for this, you should found help here or on orge forums.
-wait for the next orge distrib that should have a 0.4x CEGUI version.
-compile the 0.4 version and integrate it with orge.
(i can't help you on that, never did before)
for this, you should found help here or on orge forums.
-wait for the next orge distrib that should have a 0.4x CEGUI version.
Re: Getting to men-u
I have just update my cegui to 0.4.1 Now I can use Windowslook
I have modified the code to this
and work fine so, but I dont know why if I use the /* code */ give me a problem with the mouse event (Which It worked perfect without /*code*/)
the mouse event is:
And I think is perfect because I copied it

I have modified the code to this
Code: Select all
CEGUI::Menubar* menu = (CEGUI::Menubar*)CEGUI::WindowManager::getSingleton().createWindow("WindowsLook/Menubar", (CEGUI::utf8*)"menu");
mEditorGuiSheet->addChildWindow(menu);
menu->setPosition(CEGUI::Point(0.0f, 0.0f));
menu->setSize(CEGUI::Size(1.0f, 0.03f));
CEGUI::MenuItem* mfile = (CEGUI::MenuItem*)CEGUI::WindowManager::getSingleton().createWindow("WindowsLook/MenubarItem", (CEGUI::utf8*)"mfile");
mEditorGuiSheet->addChildWindow(mfile);
mfile->setText("File");
menu->addItem(mfile);
CEGUI::PopupMenu* popupmfile = (CEGUI::PopupMenu*)CEGUI::WindowManager::getSingleton().createWindow("WindowsLook/PopupMenuItem", (CEGUI::utf8*)"popupmfile");
mfile->setPopupMenu(popupmfile);
/*CEGUI::MenuItem* itemexit=(CEGUI::MenuItem*)CEGUI::WindowManager::getSingleton().createWindow("WindowsLook/MenubarItem", (CEGUI::utf8*)"exit");
itemexit->setText("Exit");
popupmfile->addItem(itemexit);*/
and work fine so, but I dont know why if I use the /* code */ give me a problem with the mouse event (Which It worked perfect without /*code*/)
the mouse event is:
Code: Select all
void mouseMoved (MouseEvent *e)
{
CEGUI::System::getSingleton().injectMouseMove(
e->getRelX() * mGUIRenderer->getWidth(),
e->getRelY() * mGUIRenderer->getHeight());
e->consume();
}
And I think is perfect because I copied it

Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 4 guests