The OpenD Programming Language

Widget.defaultEventHandler_mouseup

Default event handlers. These are called on the appropriate event unless Event.preventDefault is called on the event at some point through the bubbling process.

More...
class Widget
void
defaultEventHandler_mouseup

Detailed Description

If you are implementing your own widget and want to add custom events, you should follow the same pattern here: create a virtual function named defaultEventHandler_eventname with the implementation, then, override setupDefaultEventHandlers and add a wrapped caller to defaultEventHandlers["eventname"]. It should be wrapped like so: defaultEventHandlers["eventname"] = (Widget t, Event event) { t.defaultEventHandler_name(event); };. This ensures virtual dispatch based on the correct subclass.

Also, don't forget to call super.setupDefaultEventHandlers(); too in your overridden version.

You only need to do that on parent classes adding NEW event types. If you just want to change the default behavior of an existing event type in a subclass, you override the function (and optionally call super.method_name) like normal.

Meta