then why it also generates the event for moving wxButton which isn't wxTopLevelWindow?holds information about wxTopLevelWindow move change events
MCVE:
Code: Select all
#include <wx/wx.h>
#include <wx/dataview.h>
class MyFrame : public wxFrame
{
public:
MyFrame(const wxString& title) : wxFrame(NULL, wxID_ANY, title)
{
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
m_button = new wxButton(this, wxID_ANY, wxT(""), wxDefaultPosition, wxDefaultSize, 0);
m_button->Bind(wxEVT_MOVE, [this](wxMoveEvent& event) {
m_textCtrl->AppendText("Move");
event.Skip();
});
topSizer->Add(m_button, 0, wxALL, 5);
m_button2 = new wxButton(this, wxID_ANY, wxT("Click"), wxDefaultPosition, wxDefaultSize, 0);
m_button2->Bind(wxEVT_COMMAND_BUTTON_CLICKED,
[&](wxCommandEvent& event)
{
m_button->Move(50, 0);
});
topSizer->Add(m_button2, 0, wxALL, 5);
m_textCtrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
topSizer->Add(m_textCtrl, 0, wxALL, 5);
this->SetSizer(topSizer);
this->Layout();
this->Centre(wxBOTH);
}
private:
wxButton* m_button;
wxButton* m_button2;
wxTextCtrl* m_textCtrl;
};
class MyApp : public wxApp
{
public:
virtual bool OnInit()
{
if (!wxApp::OnInit())
return false;
MyFrame* frame = new MyFrame("wxWidgets application");
frame->Show(true);
return true;
}
};
wxIMPLEMENT_APP(MyApp);