How to trace events? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
cecilio
I live to help wx-kind
I live to help wx-kind
Posts: 189
Joined: Fri Dec 03, 2004 8:44 am
Location: spain
Contact:

How to trace events?

Post by cecilio »

Is there a simple way or a tool to trace the loop of events? I would like to investigate the sequence of events that creates a problem in my app.

Thanks.
DavidHart
Site Admin
Site Admin
Posts: 4254
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: How to trace events?

Post by DavidHart »

Hi,
Is there a simple way or a tool to trace the loop of events?
Yes and no.

The simple way is to override wxApp::FilterEvent and examine each event as it passes through. A couple of years ago I did start to write a tool that did this.

The bad news is, it was seldom useful. It helped when it was important to know that event A was being fired before event B; but that information is not often what's needed. It's commoner to want to watch an event being passed up the chain of eventhandlers to see where it dies. That would require overriding (or replacing) some part of the event loop itself; and even then, it's difficult to identify each control from just its memory address.

So I gave up. Perhaps a better approach would be to do clever things with a debugger, though that wouldn't solve the identity problem...

Regards,

David
cecilio
I live to help wx-kind
I live to help wx-kind
Posts: 189
Joined: Fri Dec 03, 2004 8:44 am
Location: spain
Contact:

Re: How to trace events?

Post by cecilio »

Thank you David,

In my case I would like to investigate a couple of issues related to the same window. So I will try to handle all events in a single handler and invoke the real handlers from there, after logging the event.

Thanks for your help. Regards,
Cecilio
Post Reply