need help Handling CEGUI events

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
jed
Just popping in
Just popping in
Posts: 14
Joined: Fri May 20, 2005 14:51

need help Handling CEGUI events

Postby jed » Sun May 22, 2005 13:41

Hi Guys, I'm having trouble getting event handling to work. I also set up event hanlders for mouseEnter and MouseLeave but none get called? All these things display fine.

[code]CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
wmgr.getWindow("Spellbar")->subscribeEvent(
CEGUI::Window::EventMouseClick,
CEGUI::Event::Subscriber(&Spellbar::handleMouseClick, this));

from my .layout file:
<GUILayout>
<Window Type="DefaultGUISheet" Name="root">
<Window Type="DefaultGUISheet" Name="Spellbar">
<Property Name="Position" Value="x:0 y:.85" />
<Property Name="Size" Value="w:1 h:.2" />
<Window Type="TaharezLook/StaticImage" Name="Spellbar/background">
<Property Name="MetricsMode" Value="Absolute" />
<Property Name="Position" Value="x:0 y:0" />
<Property Name="Size" Value="w:600 h:68" />
<Property Name="Image" Value="set:MainScreen image:Spellbar" />
<Property Name="FrameEnabled" Value="false" />
</Window>
</Window>
</Window>
</GUILayout>[/code]

Any ideas whatelse I need to do?

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

Re: need help Handling CEGUI events

Postby lindquist » Sun May 22, 2005 14:35

try changing this line:

Code: Select all

 CEGUI::Event::Subscriber(&Spellbar::handleMouseClick, this));


to this:

Code: Select all

 CEGUI::Event::Subscriber(Spellbar::handleMouseClick, this));


That's how I do it...
If this does not work, I'll look more into the event system. This is'nt the first time trouble like this is posted...

User avatar
jed
Just popping in
Just popping in
Posts: 14
Joined: Fri May 20, 2005 14:51

Re: need help Handling CEGUI events

Postby jed » Sun May 22, 2005 15:57

No it still doesn't get any events.

I looked at trying the latest CEGUI in cvs since it seems like a lot has changed but I don't see an Ogre renderer there? Is there an easy way to get the currrent cvs version to work with ogre?

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

Re: need help Handling CEGUI events

Postby lindquist » Sun May 22, 2005 16:46

The Ogre renderer has been moved outside of CEGUI and into Ogre itself instead.

User avatar
jed
Just popping in
Just popping in
Posts: 14
Joined: Fri May 20, 2005 14:51

Re: need help Handling CEGUI events

Postby jed » Sun May 22, 2005 19:06

Thanks I got it working. Stupid mistake on my part.

User avatar
Viper
Just popping in
Just popping in
Posts: 16
Joined: Mon Aug 29, 2005 01:27
Location: US
Contact:

Re: need help Handling CEGUI events

Postby Viper » Mon Aug 29, 2005 01:37

jed,

If you happen to still be reading this forum, could you please post what your solution was? I am now having the same problem and came across this post. I just found ceGUI and am trying to implement it into a game that I have been working on. My layout and everything loads, I get the event registered with no errors now, but my handler never gets called. I am currently only trying to implement a handler for MouseEnter.

Thanks for the help.

During GUI setup:

Code: Select all

wmgr.getWindow("btnSingle")->subscribeEvent(CEGUI::ButtonBase::EventNamespace+"/"+CEGUI::ButtonBase::EventMouseEnters,CEGUI::Event::Subscriber(EventMouseOver));
   


And the handler:

Code: Select all

bool EventMouseOver(const CEGUI::EventArgs& e)
{
   SoundManager->PlaySound(g_iGameSounds[MENU_DRAGOVER]);
   return true;
};


I have set a breakpoint in the handler, but it never gets called. Also, I am injecting inputs properly as the cursor moves and the buttons highlight when moved over.

User avatar
Viper
Just popping in
Just popping in
Posts: 16
Joined: Mon Aug 29, 2005 01:27
Location: US
Contact:

Re: need help Handling CEGUI events

Postby Viper » Mon Aug 29, 2005 01:53

Okay, found my problem. I was making the event subscription way too complicated. I changed:

Code: Select all

wmgr.getWindow("btnSingle")->subscribeEvent(CEGUI::ButtonBase::EventNamespace+"/"+CEGUI::ButtonBase::EventMouseEnters,CEGUI::Event::Subscriber(EventMouseOver));


to

Code: Select all

wmgr.getWindow("btnSingle")->subscribeEvent("MouseEnter",EventMouseOver);


It works fine now!

BTW, CrazyEddie, great piece of software! Once I get this all figured out, I would be interested in helping you write tutorials to make the learning curve less steep.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: need help Handling CEGUI events

Postby CrazyEddie » Mon Aug 29, 2005 07:59

Viper wrote:
BTW, CrazyEddie, great piece of software! Once I get this all figured out, I would be interested in helping you write tutorials to make the learning curve less steep.

Thanks :)

Any and tutorials should now be done via the wiki - and we're most grateful for all efforts in this area.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 2 guests