Page 1 of 1

PopupMenu

Posted: Mon Sep 26, 2005 21:46
by Van
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);

Re: PopupMenu

Posted: Tue Sep 27, 2005 11:11
by Blakharaz
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.

Re: PopupMenu

Posted: Tue Sep 27, 2005 14:24
by Van
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)?

Re: PopupMenu

Posted: Sat Oct 01, 2005 04:21
by lindquist
Could you post your CEGUI.log ?

Re: PopupMenu

Posted: Thu Oct 06, 2005 15:40
by Van
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.