There are three ways for you to deal with events in JLib. I find myself using a combination of all of them.
There are methods in JWindow called preHandleEvents() and postHandleEvents(). Both take a JEventData *, which contains the information you have in a normal window procedure, including the MRESULT return code.
Each message the window receieved is offered to preHandleEvent(). If you return false from there (which the default does) then the event is passed on to the handlers attached to the window and eventually gets passed to the orginal window procedure. After this has finished and before control is passed back to PM, postHandleEvent() is called. Thus you can write old-fashioned switch( msg) type window procedures in this way, hooking in before and/or after the default action has occurred.
Attach handlers for the messages to which you wish to respond to your windows. If you handle a message, set the return code in the event and return true to tell JLib that you've handled the message & no-one else need bother.
You can't stop postHandleEvent from being called, sorry.
You may notice that controls (eg. JEntryField have a bunch of virtual functions for event notifications. This is the third way of event handling; it really only applies to messages delivered from controls via WM_CONTROL. But anyway: to enable this, you must call adopt() for the control in the owner. Otherwise, WM_CONTROL messages will just drift around to be collected all in one bucket by a JCtrlHandler. For example:
class MyDialog : public JDialog
{
MyCheckbox cb;
public:
MyDialog( ...) : JDialog( ...), cb( this, ...)
{
adopt( &cb);
}
};
All this does is to attach a JCtrlHandler under the covers, and route events appropriately. Thus events of this type are dispatched during the handler-walking part of event handling.