Simberon Design Minute
 

Debugging Rapid Fire Events

I'm working on a project where a complicated algorithm needs to be executed on a mouse moved event. The problem is that it's hard to get just one mouse moved event at a time to debug any problems. Once you move the mouse over a window, you get hundreds of events. If the event causes an exception, you may get hundreds of exception windows raised all at once. There are several things you can do to help debug problems like this. First, you can make mouse move events only process when the control key is pressed. This way, you can control when the event is processed. Next, using a global variable you can set it up so that once an event is processed, no other events are processed until after the control key is released. That will at least slow down the events so you can debug them one at a time. I make heavy use of watchpoints in the debugger to allow me to see what's happening without opening new windows and without interfering with the normal operation of the window. It takes a bit of thought and effort, but there are effective ways to debug rapid fire events.

Download