User forums > General (but related to Code::Blocks)

Adding a wxPanel to a wxFrame advice. First time.

(1/1)

Aaron:
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?

oBFusCATed:
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.

Aaron:
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.

oBFusCATed:
You can add them from the toolbar with all the other controls in wxSmith.

Aaron:
So I see.
That was easy.

Thanks ObFusCATed

Navigation

[0] Message Index

Go to full version