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
[SOLVED] How to retrieve window that generated an event?
Moderators: CEGUI MVP, CEGUI Team
-
- Just popping in
- Posts: 13
- Joined: Sat Feb 27, 2010 09:16
Re: [SOLVED] How to retrieve window that generated an event?
Sorry, i have a question of this kind - how to extract event type (CEGUI::PushButton::EventClicked for e.g.)?
- 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?
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.
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.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
-
- Just popping in
- Posts: 13
- Joined: Sat Feb 27, 2010 09:16
Re: [SOLVED] How to retrieve window that generated an event?
Thanks, i 'll try to think my architecture over..)
Who is online
Users browsing this forum: No registered users and 3 guests