wxGetApp eeror 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
gtafan
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 201
Joined: Wed Mar 29, 2017 9:52 am

wxGetApp eeror

Post by gtafan »

When I am triing to use wxGetApp() in my application, for example in the constructor of MyFrame, which is the frame class, I am geting this error mesage:

error: 'wxGetApp' was not declared in this scope
User avatar
doublemax
Moderator
Moderator
Posts: 19160
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wxGetApp eeror

Post by doublemax »

You need to use the DECLARE_APP(YourAppName) where ever you want to use the wxGetApp macro.

Note that if you only need to access the base methods and not methods of the derived class, you can use the global wxTheApp pointer.
Use the source, Luke!
gtafan
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 201
Joined: Wed Mar 29, 2017 9:52 am

Re: wxGetApp eeror

Post by gtafan »

doublemax wrote:You need to use the DECLARE_APP(YourAppName) where ever you want to use the wxGetApp macro.

Note that if you only need to access the base methods and not methods of the derived class, you can use the global wxTheApp pointer.
Thanks a lot, this is the problem with code snipets from the net, some information was mising there, but now I know.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGetApp eeror

Post by ONEEYEMAN »

Hi,
Always!! check the sample first, before going to the web to search for the answer.

Thank you.
gtafan
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 201
Joined: Wed Mar 29, 2017 9:52 am

Re: wxGetApp eeror

Post by gtafan »

ONEEYEMAN wrote:Hi,
Always!! check the sample first, before going to the web to search for the answer.

Thank you.
Which sample? I was tallking about code snipet not related to samples.
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7480
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxGetApp eeror

Post by ONEEYEMAN »

Hi,
Usually people start with minimal sample.
But in general - if you know what you are looking for, you go to the documentation first, then the sample, and only then go to search the web (Google).

That should be the standard course of actions for every issue related to wxWidgets.

Thank you.
gtafan
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 201
Joined: Wed Mar 29, 2017 9:52 am

Re: wxGetApp eeror

Post by gtafan »

ONEEYEMAN wrote:Hi,
Usually people start with minimal sample.
But in general - if you know what you are looking for, you go to the documentation first, then the sample, and only then go to search the web (Google).

That should be the standard course of actions for every issue related to wxWidgets.

Thank you.
I agree about documentation, but samples are not of relly use for people with low wxWidgets knowledge. For simple things documentation is enough and for complicated things the samples are to complicated, that internationalization sample is the best example.
Post Reply