PopupMenu

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

PopupMenu

Postby Van » Mon Sep 26, 2005 21:46

Could someone with PopupMenu knowledge please give a quick overview what how to implement it?

This is what I am trying but it doesn't work.

Code: Select all

   // PopupMenu
   mPopupMenu = (CEGUI::PopupMenu *)mWinMgr->createWindow(
      "DefaultWindow", "Portfolio/PopupMenu");

   mIEInventoryDetail = (CEGUI::ItemEntry *)mWinMgr->createWindow(
      (CEGUI::utf8*)"TaharezLook/StaticText", "Portfolio/PopupMenu/InventoryDetail");
   mIEInventoryDetail->setText("Details");
   mPopupMenu->addItem(mIEInventoryDetail);



When I run it in debug, I get the following:

[color=0000FF]Unhandled exception at 0x05eb45f0 in Client.exe: 0xC0000005: Access violation writing location 0xabababab.[/color]

at this line:

Code: Select all

mPopupMenu->addItem(mIEInventoryDetail);

User avatar
Blakharaz
Not too shy to talk
Not too shy to talk
Posts: 31
Joined: Wed Jan 12, 2005 12:06
Location: Potsdam, Germany
Contact:

Re: PopupMenu

Postby Blakharaz » Tue Sep 27, 2005 11:11

You are trying to insert an instance of StaticText (statically casted into an ItemEntry) into the popup menu.

The class MenuItem is the one you need, so try to use the line

Code: Select all

mIEInventoryDetail = (CEGUI::ItemEntry *)mWinMgr->createWindow(
      (CEGUI::utf8*)"TaharezLook/MenuItem", "Portfolio/PopupMenu/InventoryDetail");

to create your menu item.
Coder in the Pantheon Team - creators of "Rastullahs Lockenpracht" (http://www.rastullahs-lockenpracht.de/)

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: PopupMenu

Postby Van » Tue Sep 27, 2005 14:24

Thank you Blakharaz for replying. I over-looked that little typo. :oops:

But, I now get the following error:

[color=0000FF]Unhandled exception at 0x7c81eb33 in Client.exe: Microsoft C++ exception: CEGUI::UnknownObjectException @ 0x0012dc5c.[/color]


Code: Select all

   // PopupMenu

   mPopupMenu = (CEGUI::PopupMenu *)mWinMgr->createWindow(
      "DefaultWindow", "Portfolio/PopupMenu");

   mIEInventoryDetail = (CEGUI::ItemEntry *)mWinMgr->createWindow(
      (CEGUI::utf8*)"TaharezLook/MenuItem", "Portfolio/PopupMenu/InventoryDetail");
   mIEInventoryDetail->setText("Details");
   mPopupMenu->addItem(mIEInventoryDetail);




It is happening when the line:

Code: Select all

   mIEInventoryDetail = (CEGUI::ItemEntry *)mWinMgr->createWindow(
      (CEGUI::utf8*)"TaharezLook/MenuItem", "Portfolio/PopupMenu/InventoryDetail");


is being executed. I take this to mean that the CEGUI doesn't think that TaharezLook/MenuItem exists. However, it DOES exist in the TaharezLook.looknfeel file. That designator does not exist in any other file. Perhaps I am doing something else wrong? Am I forgetting to initialize something? A new parameter (i.e. falagard related)?

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Re: PopupMenu

Postby lindquist » Sat Oct 01, 2005 04:21

Could you post your CEGUI.log ?

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: PopupMenu

Postby Van » Thu Oct 06, 2005 15:40

FYI, I found the problem. I was loading the wrong scheme.

I changed this:

Code: Select all

   CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLook.scheme");


to this:

Code: Select all

   CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");


Note that I had to change the scheme file name from TaharezLook.scheme to TaharezLookSkin.scheme in order to get the PopupMenu widget support.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 23 guests