I am just getting started. I have searched the forum, but didn't find an answer to the following question on events:
Is there a way for an EventSuscriber function to determine the event that is being sent to it in the EventArgs object?
My old GUI system uses a unified event handler to which my scriptors have grown accunstomed. My goal is to be able to use all of the existing Lua scripts in future products that use CEGUI for GUI functionality.
The Lua event handler is in the form of:
function EventHandler(objectName, eventName, ...)
-- do someing interesting
end
Thanks!
Event Description
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Event Description
No, there is no system for this. I went out of my way to avoid anything that might see single, huge, monolithic "event handler" functions that contain a big switch statement or massive if/else if constructs - which I dislike (and yes, the xml handlers I've written pain me whenever I have to look at them ).
I think the only way you can do this in is to have a collection of 'proxy handlers' that you subscribe to the events, and use these to despatch into a monolithic handler and pass the event type in.
I think the only way you can do this in is to have a collection of 'proxy handlers' that you subscribe to the events, and use these to despatch into a monolithic handler and pass the event type in.
Useful Links: Forum Guidelines | Documentation | Tutorials | HOWTO | Videos | Donate to CEGUI | CEGUI Twitter
Re: Event Description
Thanks, that is pretty much what I did.
Also, the old system uses a Lua event handler that is settable per widget, so you could have that big, nasty if/else mess, but you could also have a handler that handles all events that it cares about in one spot per widget.
Different stokes and all that...
Also, the old system uses a Lua event handler that is settable per widget, so you could have that big, nasty if/else mess, but you could also have a handler that handles all events that it cares about in one spot per widget.
Different stokes and all that...
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 3 guests