wxGetApp() not working Topic is solved
wxGetApp() not working
Hey,,
Thanks for those links.. actually, i am unaware of those technical terms (like flicker).. anyways, it helped me lot and my problem is solved.. Thanks anyways..
One more small doubt.. I am not able to use wxGetApp() function from any other class, other then MyApp class...
I have declared,
DECLARE_APP(myapp) in the header file (MyApp.h).. still it is not working.. what may be the problem.? I have also included,
#include <wx/app.h>
Thanks and Regards
Rakesh
Thanks for those links.. actually, i am unaware of those technical terms (like flicker).. anyways, it helped me lot and my problem is solved.. Thanks anyways..
One more small doubt.. I am not able to use wxGetApp() function from any other class, other then MyApp class...
I have declared,
DECLARE_APP(myapp) in the header file (MyApp.h).. still it is not working.. what may be the problem.? I have also included,
#include <wx/app.h>
Thanks and Regards
Rakesh
-
- Knows some wx things
- Posts: 36
- Joined: Mon Jan 01, 2007 10:55 am
does MyApp.h looks like this?rakeshthp wrote:On including MyApp.h in all the classes am getting list of errors in each class wher i include it.. any other solution??
Code: Select all
#ifndef __MYAPP_H__
#define __MYAPP_H__
App class declaration
DECLARE_APP(MyApp)
#endif
Yakumo, searching Pai.
myapp.h definition looks like this
#include <wx/wx.h>
#include "FrameEX.h"
class ESPL : public wxApp{
public:
FrameEX *m_esplframe;
virtual bool OnInit();
ESPL();
~ESPL();
}
DECLARE_APP(ESPL)
And .cpp file contains
#include "ESPL.h"
IMPLEMENT_APP(ESPL)
ESPL::ESPL(){
// code to initialize
}
ESPL::~ESPL(){
remove("Points"); // removing temp file
}
bool ESPL::OnInit(){
m_esplframe = new FrameEX(NULL,wxID_ANY,wxT("Graphics Application"), wxDefaultPosition, wxDefaultSize);
m_esplframe->Show(true);
}
Thats it.. What else has to be there..?? Any rules are there to make wxGetApp() work..?? Or any situations where wxGetApp() doesnt work??
#include <wx/wx.h>
#include "FrameEX.h"
class ESPL : public wxApp{
public:
FrameEX *m_esplframe;
virtual bool OnInit();
ESPL();
~ESPL();
}
DECLARE_APP(ESPL)
And .cpp file contains
#include "ESPL.h"
IMPLEMENT_APP(ESPL)
ESPL::ESPL(){
// code to initialize
}
ESPL::~ESPL(){
remove("Points"); // removing temp file
}
bool ESPL::OnInit(){
m_esplframe = new FrameEX(NULL,wxID_ANY,wxT("Graphics Application"), wxDefaultPosition, wxDefaultSize);
m_esplframe->Show(true);
}
Thats it.. What else has to be there..?? Any rules are there to make wxGetApp() work..?? Or any situations where wxGetApp() doesnt work??
-
- Knows some wx things
- Posts: 36
- Joined: Mon Jan 01, 2007 10:55 am
Don't take these words as if I want to tell you off, but please, when you post code, use the code tag.rakeshthp wrote:myapp.h definition looks like this
#include <wx/wx.h>
#include "FrameEX.h"
class ESPL : public wxApp{
public:
FrameEX *m_esplframe;
virtual bool OnInit();
ESPL();
~ESPL();
}
DECLARE_APP(ESPL)
And .cpp file contains
#include "ESPL.h"
IMPLEMENT_APP(ESPL)
ESPL::ESPL(){
// code to initialize
}
ESPL::~ESPL(){
remove("Points"); // removing temp file
}
bool ESPL::OnInit(){
m_esplframe = new FrameEX(NULL,wxID_ANY,wxT("Graphics Application"), wxDefaultPosition, wxDefaultSize);
m_esplframe->Show(true);
}
Thats it.. What else has to be there..?? Any rules are there to make wxGetApp() work..?? Or any situations where wxGetApp() doesnt work??
Second of all, get sure all your header files use the "once only header" technique:
http://gcc.gnu.org/onlinedocs/cpp/Once_ ... ly-Headers
More: I don't know how are the constructors of wxApp, but when you derive one class from another, in the derived class you should call the base class constructor.
Code: Select all
ESPL::ESPL()
: wxApp() // <-- Calls the base constructor
{
// code to initialize
}
Anyway, for wxApp derived class, I do not recommend creating constructors nor destructors. Just use the OnInit and the OnExit, so your "remove(Points)" will be called in the OnExit method of your ESPL class.
Try first these things and then tell me.
Yakumo, searching Pai.
-
- Knows some wx things
- Posts: 36
- Joined: Mon Jan 01, 2007 10:55 am