Bug avec wxFrame::GetPosition()
Bonjour alors voila mon programme bug quand il appele la function suivant:
wparent->GetPosition();
voici le code:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
//---- main.cpp
bool MyApp::OnInit()
MainFrame *frame = new MainFrame( _T("Vicia GUI"), wxPoint(1500,50), wxSize(600,400) );
frame->Show(TRUE);
}
//---- MainFrame.cpp
MainFrame::MainFrame(const wxString& title, const wxPoint& pos, const wxSize& size)
: wxFrame((wxFrame *)NULL, wxID_ANY, title, pos, size) {
....
MainMenuBar *menuBar = new MainMenuBar(this);
}
//----- MainMenuBar.h
class MainMenuBar: public wxMenuBar {
public:
MainMenuBar(wxFrame* wparent_);
...
void OnProperties(wxCommandEvent& event);
private:
wxFrame* wparent;
}
//---- MainMenuBar.cpp
MainMenuBar::MainMenuBar(wxFrame *wparent_)
:wparent(wparent_)
{
... this->Connect(wxID_PROPERTIES,wxEVT_COMMAND_MENU_SELECTED,wxCommandEventHandler(MainMenuBar::OnProperties));
..
}
void MainMenuBar::OnProperties(wxCommandEvent& WXUNUSED(event)) {
//BEFORE BUG
wxPoint pos = wparent->GetPosition();
//AFTER BUG
} |
Et je comprend pas du tout d'où viens le problème, si qqun a déjà eu ce genre de problème ça serait sympa de commenter