Author Topic: Adding a wxPanel to a wxFrame advice. First time.  (Read 1964 times)

Offline Aaron

  • Multiple posting newcomer
  • *
  • Posts: 57
Adding a wxPanel to a wxFrame advice. First time.
« 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?

« Last Edit: March 16, 2015, 08:05:50 pm by Aaron2 »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11767
    • Travis build status
Re: Adding a wxPanel to a wxFrame advice. First time.
« Reply #1 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Aaron

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: Adding a wxPanel to a wxFrame advice. First time.
« Reply #2 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.
« Last Edit: March 16, 2015, 10:12:20 pm by Aaron2 »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11767
    • Travis build status
Re: Adding a wxPanel to a wxFrame advice. First time.
« Reply #3 on: March 17, 2015, 12:23:36 am »
You can add them from the toolbar with all the other controls in wxSmith.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Aaron

  • Multiple posting newcomer
  • *
  • Posts: 57
Re: Adding a wxPanel to a wxFrame advice. First time.
« Reply #4 on: March 17, 2015, 12:47:59 am »
So I see.
That was easy.

Thanks ObFusCATed