I wrote a very simple program.one frame,one menu,one button
but the sentence SetMenuBar( menuBar ) cannot exist with the
EVT_SIZE(MyFrame::OnSize)
void MyFrame::OnSize(wxSizeEvent& event)
{
if(myButton)
{
wxSize size = GetClientSize();
myButton->SetSize(0,0,size.x,size.y);
}
event.Skip();
}
why?
when I run the application,it show a memory err.
the problem of resize event Topic is solved
-
- Earned a small fee
- Posts: 22
- Joined: Tue Jan 17, 2006 9:49 am
-
- Earned a small fee
- Posts: 22
- Joined: Tue Jan 17, 2006 9:49 am
-
- Earned a small fee
- Posts: 22
- Joined: Tue Jan 17, 2006 9:49 am
the problem is the button point invalidation.
I donot understand
My button point has been defined in the head file.
I change the construct function from
//////////////////////
myFrame::myFrame(wxWindow *pParent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
: wxFrame(pParent, id, title, pos, size, style, name)
{
CreateGUIControls();
}
//////////////////////
to
//////////////////////
myFrame::myFrame(wxWindow *pParent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style, const wxString& name)
: wxFrame(pParent, id, title, pos, size, style, name),myButton(NULL)
{
CreateGUIControls();
}
//////////////////////
all is ok
what different between them?
and all the initializtion code is in CreateGUIControls()
-
- Earned a small fee
- Posts: 22
- Joined: Tue Jan 17, 2006 9:49 am