Page 1 of 1

Control in new frame - maximized?

Posted: Tue May 10, 2005 6:13 pm
by cr_itm
Hello,

when I create a new wxFrame and add a control (a textctrl, a button etc...)to it, that control ignores it's size settings and will be maximized, so it fills out the frame.

May someone explain to me, why this happens?


Thanks a lot (from a wxWidgets beginner ;) )

Posted: Tue May 10, 2005 8:26 pm
by Jorg
The first control in a wxFrame will always be maximised. The reason for this is that the frame is always filled with a wxPanel first. So what you need to do is this

Code: Select all

myFrame *frm = new wxFrame(...);
wxPanel *pnl = new wxPanel(frm);

// now add your controls to the panel instead of the frame.
new wxButton(-1, pnl);