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: 14
Joined: Wed Apr 25, 2012 2:45 am

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

Post by guanlisheng » Thu Jun 09, 2016 12:12 am

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: 14992
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 » Thu Jun 09, 2016 5:52 am

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: 14
Joined: Wed Apr 25, 2012 2:45 am

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

Post by guanlisheng » Thu Jun 09, 2016 5:05 pm

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: 14
Joined: Wed Apr 25, 2012 2:45 am

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

Post by guanlisheng » Fri Jun 10, 2016 6:15 am

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

Developer of Money Manager Ex

Post Reply