[Solved] Mapping of Events -> EventArgs

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

Gokkan
Just popping in
Just popping in
Posts: 2
Joined: Fri Dec 18, 2009 17:25

[Solved] Mapping of Events -> EventArgs

Postby Gokkan » Fri Dec 18, 2009 18:10

Is there a document somewhere that specifies what the mapping of Events to EventArgs is?

For example, CEGUI::Window has a number of events such as: EventMouseButtonDown, EventMouseClick, EventMouseMove, etc. When I subscribe to these events, I give it a handler such as:

Code: Select all

bool foo(const CEGUI::EventArgs& args);


When I write foo, how do I know what to cast args as?

My question came about when I was trying to use MouseEventArgs for EventMouseClick but it was throwing exceptions. I looked at the demos and switched to EventMouseButtonDown instead, but I'm still curious what EventMouseClick should be using. Of course, I'm open to the possibility that I was simply doing something wrong with EventMouseClick, but I was curious how developers determine which EventArgs to use for which Events?

Thanks in advance for your time and help! :D
Last edited by Gokkan on Fri Dec 18, 2009 18:48, edited 1 time in total.

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

Re: Mapping of Events -> EventArgs

Postby CrazyEddie » Fri Dec 18, 2009 18:36

Hi,

First I agree that this information is not readily available / accessible. Really we should add to the docs for all the Event* descriptions that specifies the type of args you'll be passed. I'll add a mantis ticket so we hopefully will get that done in the future.

So, how can to tell the args? You still ask! Probably the best way is to look at the class member function that corresponds to the event (most events and classes have them, but not all - which is why the docs update will be important). So for example, the case you mention for Window::EventMouseClick, there is a protected member function Window::onMouseClick, by looking at the function signature we can see that the function takes a MouseEventArgs object (so you must have had a bug / issue of some kind!).

HTH

CE.

Gokkan
Just popping in
Just popping in
Posts: 2
Joined: Fri Dec 18, 2009 17:25

Re: Mapping of Events -> EventArgs

Postby Gokkan » Fri Dec 18, 2009 18:47

Cool! Thanks for the help!

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: [Solved] Mapping of Events -> EventArgs

Postby Jamarr » Fri Dec 18, 2009 19:32

I'm surprised this hasn't come up before. I have also had to deal with this annoyance on more than one occasion :)
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: [Solved] Mapping of Events -> EventArgs

Postby Jamarr » Fri Feb 05, 2010 22:42

For anyone looking for the mantis ticket, you can find it here: http://www.cegui.org.uk/mantis/view.php?id=321
/sneakybump
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

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

Re: [Solved] Mapping of Events -> EventArgs

Postby CrazyEddie » Sat Feb 06, 2010 09:42

Yeah, yeah... Some tickets take years to get done :lol:

This should not be one of those due to it being just a text fix, so... soon :)

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 31 guests