How to create an application-wide variable?
Jorgen Bodde
jorgen.maillist at gmail.com
Tue Feb 5 01:20:03 PST 2008
Use it as;
wxGetApp().m_yourVar
What wxGetApp() does is returning the reference to the class you
defined for your application. You can store variables in there but
must be aware that if you cross e.g. a GUI-less logical / data part of
your code, and you need the global vars there as well, you are mixing
GUI code in your object data classes.
A singleton is more elegant as it has no reference to wx in it
- Jorgen
On Feb 4, 2008 5:58 PM, Milan Babuskov <milanb at panonnet.net> wrote:
> Herry Ayen Yang wrote:
> > How to make an application-wide variable in wxWidgets programming?
>
> Singleton pattern?
>
>
>
> --
> Milan Babuskov
> http://www.flamerobin.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wx-users-help at lists.wxwidgets.org
>
>
More information about the wx-users
mailing list