tbx  0.7.3
The tbx event system

The events in a tbx application can be categorised into two types:

Object/Gadget default events

These are the default events generated by the underlying toolbox object/gadget.

They are caught in a tbx application by adding a listener for the specific event to the object/gadget they apply to.

e.g To add a changed listener to a writeable field w:

w.add_text_changed_listener(&my_listener);

The my_listener object is derived from a TextChangedListener and has its text_changed member called when the writeable field text changes.

You can add multiple listeners to the same event.

Note: The object/gadget must be set to deliver the event in the toolbox resource file for the listener to be called.

Events

These are events with number you have specified. They should be in the range 1 to 0x4FFF.

These events are routed, that the item that is run is first tried on the object where the event originated. Then on the parent object. Next on the ancestor object and finally on the application.

The first object/gadget that handles the event stops it from being bubbled up to the next higher level.

User events are caught in tbx by using the add_command method on an object or the application.

Commands

The Command class is used as a base for commands that can be executed from an event. It includes a virtual execute method that needs to be overridden to provide the command functionality.

Commands can be added to user events (see above) or to specific functionality of a gadget or object.