-
[RESOLVED] Dispatching Events, Custom Event Parameters?
Is there a way to make the single parameter for the event dispatcher either take a custom class or add arguments into it?
In other words, when dispatching events, i'd like to pass more data than just the event type. And sometimes i prefer to use the event dispatchers more dynamic setup as apposed to the more static methodology of having function references pass arguments.
Hope that made sense..
-
Senior Member
Usually, all of the arguments you will pass will be included in the event object.. So you'd need to create a custom event class which extends the original Event class, and include all the information you'd like to pass in it
you'd then use that CustomEvent when dispatching an event
-
half as fun, double the price
you'd just then use a custom event (subclass the event class and use an instance of that class as your event)
[edit]ozmic66 beat me to it [/edit]
-
ah duh, extend the event class. Good idea! Thanks
-
half as fun, double the price
Note that you should override and reimplement the clone() method, otherwise you may get errors in re-dispatching instances of your custom event.
-
ah k, interesting
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|