| Why does calling the previous event handler in a user event handler result in a crash?

Previous | Event-driven Programming, Menus, and Throwing Errors | Next

Q: | What is wrong in calling the previous installed event handler in a new one? Whenever I tried to do so, my only result is a crash...

A:

Very probably you do

    OldHandler = EV_captureEvents (NewHandler);

then you call `OldHandler` from `NewHandler`. There would be nothing wrong in doing so, but function EV_captureEvents returns NULL when there is no any user handlers previously installed, which is very common case. So, you can call `OldHandler` only if it is not null. In other words, it is illegal to call an event handler when it is not actually installed. From the other side, function EV_defaultHandler calls the TIOS handler which is used for default dispatching of some common events. It works independently of which handler is currently installed and whether it is installed at all. This is a function which you probably need to call in your event handler to process all unprocessed events.