Thanks for the reply David,
Yes, my codes are minimal problem demostrations. I don't need an empty frame.
I followed your tips and tried to use Bind for the main panel and for a button. The first, the most important for me, doesn't work.
Hier the source code
Code: Select all
NewFrame::NewFrame(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size){
//(*Initialize(NewFrame)
wxGridSizer* GridSizer1;
Create(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE, _T("wxID_ANY"));
Panel1 = new wxPanel(this, ID_PANEL1, wxPoint(168,168), wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
GridSizer1 = new wxGridSizer(0, 1, 0, 0);
StaticText1 = new wxStaticText(Panel1, ID_STATICTEXT1, _("Test"), wxDefaultPosition, wxDefaultSize, 0, _T("ID_STATICTEXT1"));
GridSizer1->Add(StaticText1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
TextCtrl1 = new wxTextCtrl(Panel1, ID_TEXTCTRL1, _("Text"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_TEXTCTRL1"));
GridSizer1->Add(TextCtrl1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
Button1 = new wxButton(Panel1, ID_BUTTON1, _("Label"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("ID_BUTTON1"));
GridSizer1->Add(Button1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
Panel1->SetSizer(GridSizer1);
GridSizer1->Fit(Panel1);
GridSizer1->SetSizeHints(Panel1);
//*)
Panel1->Bind(wxEVT_SET_FOCUS, &NewFrame::OnSetFocus, this);
Button1->Bind(wxEVT_SET_FOCUS, &NewFrame::OnSetFocus, this);
}