Is there a centralised place to oversee the widget creation/destroy

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
guanlisheng
Earned a small fee
Earned a small fee
Posts: 15
Joined: Wed Apr 25, 2012 2:45 am

Is there a centralised place to oversee the widget creation/destroy

Post by guanlisheng »

Hi all ,

i am working on an open source project (https://github.com/moneymanagerex/moneymanagerex/) and now i am trying to integrate Google Analytics to the desktop application. currently, i would add the following single line to every widget to track the usage by passing a pointer to current widgets.

Code: Select all

Model_Usage::instance().pageview(this);
the current case is that i have to add this line for all widget class which is inconvenient.
Does any one know that is there a centralised function that each widget will call during the creation and destroy?
Lisheng Guan (guanlisheng.com)

Developer of Money Manager Ex
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Is there a centralised place to oversee the widget creation/destroy

Post by doublemax »

Override wxAppConsole::FilterEvent and look for the wxEVT_CREATE event.
http://docs.wxwidgets.org/trunk/classwx ... event.html

If you want to track mouse cursor movement over your application, look for the wxEVT_ENTER_WINDOW event and use wxFindWindowAtPointer() to find the wxWindow under the mouse.

http://docs.wxwidgets.org/trunk/classwx ... c6f602e20c
http://docs.wxwidgets.org/trunk/group__ ... f3d3e406f0
Use the source, Luke!
guanlisheng
Earned a small fee
Earned a small fee
Posts: 15
Joined: Wed Apr 25, 2012 2:45 am

Re: Is there a centralised place to oversee the widget creation/destroy

Post by guanlisheng »

big thanks and will take look for the former one.
Lisheng Guan (guanlisheng.com)

Developer of Money Manager Ex
guanlisheng
Earned a small fee
Earned a small fee
Posts: 15
Joined: Wed Apr 25, 2012 2:45 am

Re: Is there a centralised place to oversee the widget creation/destroy

Post by guanlisheng »

it does work and thank you!
Lisheng Guan (guanlisheng.com)

Developer of Money Manager Ex
Post Reply