Page 1 of 1

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

Posted: Thu Jun 09, 2016 12:12 am
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?

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

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

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

Posted: Thu Jun 09, 2016 5:05 pm
by guanlisheng
big thanks and will take look for the former one.

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

Posted: Fri Jun 10, 2016 6:15 am
by guanlisheng
it does work and thank you!