Control in new frame - maximized?

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Earned a small fee
Earned a small fee
Posts: 15
Joined: Fri May 06, 2005 4:48 pm

Control in new frame - maximized?

Post by cr_itm » Tue May 10, 2005 6:13 pm


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 ;) )

Posts: 3971
Joined: Fri Aug 27, 2004 9:38 pm
Location: Delft, Netherlands

Post by Jorg » Tue May 10, 2005 8:26 pm

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);
Forensic Software Engineer
Netherlands Forensic Insitute
Jorg's WasteBucket

Post Reply