Code::Blocks

User forums => General (but related to Code::Blocks) => Topic started by: Aaron on March 16, 2015, 08:02:41 pm

Title: Adding a wxPanel to a wxFrame advice. First time.
Post by: Aaron on March 16, 2015, 08:02:41 pm
I have added a wxPanel to a project with a wxFrame.  (not quite like Layers in PhotoShop CS though) 
As I've read, the controls should be placed on the wxPanel.  So I added a couple controls.

When built & run only the empty wxFrame is displayed however.

I'm missing a step here, how does the wxPanel take precedence over the frame?
Should it become a 'Skin' of the frame?

Should I be able to use a wxPanel without a frame?

(http://www.buy-fla.com/panel.PNG)
Title: Re: Adding a wxPanel to a wxFrame advice. First time.
Post by: oBFusCATed on March 16, 2015, 08:18:35 pm
Read about sizers in the wxWidgets documentation. They are a bit hard at the beginning, but when you get used to then it is relatively easy to use them. And they solve lots of layout issues automagically.
Title: Re: Adding a wxPanel to a wxFrame advice. First time.
Post by: Aaron on March 16, 2015, 08:43:57 pm
Must the sizer be manually-coded or is it a layout attribute I'm overlooking?
I have not found any menu items for sizer.

I've heard if the panel is the only child of a wxFrame, then when the frame is sized the panel will automatically be sized also to fill all of the client area of the frame.

If this is a common usage of panel and frame, its surprising that instructions and examples are so scarce.
Title: Re: Adding a wxPanel to a wxFrame advice. First time.
Post by: oBFusCATed on March 17, 2015, 12:23:36 am
You can add them from the toolbar with all the other controls in wxSmith.
Title: Re: Adding a wxPanel to a wxFrame advice. First time.
Post by: Aaron on March 17, 2015, 12:47:59 am
So I see.
That was easy.

Thanks ObFusCATed