-
Book Overview & Buying
-
Table Of Contents
qooxdoo Beginner's Guide
qooxdoo supports event-based programming. It also supports user-defined events. It's a kind of Observer-Observable design pattern. An observable is nothing but the event defined, and the observer is the listener registered for the observable.
This is an optional configuration in the class, and the configuration key is events; for example, value-changed event on any variable, selection-changed event on list, table row selection event, mouse-click event, drag-and-drop event, key-press event on text field, and so on. One can define one or more events in the events section in class definition.
The following code snippet illustrates the event declaration for a class:
events : {
/** Fired when the widget is clicked. */
"click": "qx.event.type.MouseEvent",
/** Fired when some thing modified in the class */
"dirty" : "qx.event.type.Data"
}
The following code snippet illustrates how to add listeners for events:
// method syntax -addListener...
Change the font size
Change margin width
Change background colour