Event Description

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
madmark
Just popping in
Just popping in
Posts: 6
Joined: Tue Jul 26, 2005 18:47

Event Description

Postby madmark » Tue Jul 26, 2005 19:08

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!

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

Re: Event Description

Postby CrazyEddie » Thu Jul 28, 2005 18:24

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.

User avatar
madmark
Just popping in
Just popping in
Posts: 6
Joined: Tue Jul 26, 2005 18:47

Re: Event Description

Postby madmark » Fri Jul 29, 2005 19:40

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... :pint:


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 8 guests