[SOLVED] How to retrieve window that generated an event?

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

Houdini
Just popping in
Just popping in
Posts: 3
Joined: Wed Feb 10, 2010 22:43

[SOLVED] How to retrieve window that generated an event?

Postby Houdini » Wed Feb 10, 2010 22:46

I would really like to have a group of windows call the same "onevent" function when a particular event occurs, but I need to be able to retrieve the "user data" associated with the window that generated the event.

Is this possible?

edit: I found the solution in the wiki!!

- Houdini

madeinsoviets
Just popping in
Just popping in
Posts: 13
Joined: Sat Feb 27, 2010 09:16

Re: [SOLVED] How to retrieve window that generated an event?

Postby madeinsoviets » Thu Mar 04, 2010 09:44

Sorry, i have a question of this kind - how to extract event type (CEGUI::PushButton::EventClicked for e.g.)?

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

Re: [SOLVED] How to retrieve window that generated an event?

Postby CrazyEddie » Thu Mar 04, 2010 10:35

Hi,

It's not possible to extract the event name from within the event handler. The original idea was that since you're subscribing the handler to the event, you already know what the event name is!? This was a decision I took on purpose to stop people producing huge monolithic event handlers containing huge if / else if / endif structures that test for which event it is. With some hindsight, perhaps it is not for me to dictate how users of the library structure there code - but for now this is the situation.

I'm prepared to consider adding a second argument to the event handler function prototype that holds a reference to the event name String. Off the top of my head I'm unsure if this can be done in a suitable fashion for the stable branch - so it may end up being a svn trunk / v0.8.x kind of an enhancement.

CE.

madeinsoviets
Just popping in
Just popping in
Posts: 13
Joined: Sat Feb 27, 2010 09:16

Re: [SOLVED] How to retrieve window that generated an event?

Postby madeinsoviets » Thu Mar 04, 2010 13:33

Thanks, i 'll try to think my architecture over..)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 8 guests