wxFormBuilder won't build what I want

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
User avatar
shawnhcorey
Knows some wx things
Knows some wx things
Posts: 41
Joined: Mon Nov 19, 2012 3:29 pm
Location: The Great White North

wxFormBuilder won't build what I want

Post by shawnhcorey »

I am trying to build something like this:

Code: Select all

AppNBPage : wxPanel
    wxSplitterWindow
        wxTreeCtrl
        wxGrid

AppMainWin : wxFrame
    AppMainPanel : wxPanel
        wxBoxSizer
            AppMenuBar : wxMenuBar
            AppToolBar : wxToolBar
            AppSttusBar : wxStatusBar
            AppNB : wxAUINotebook
                AppNBPage
                ...
1. wxFormBuilder won't let me put a wxBoxSizer in a wxPanel. It insists that the wxSizer goes in the wxFrame.

2. It won't let me put a wxSplitterWindow in a wxPanel or a wxAUINotebook.

What am I doing wrong?
WARNING: Highly caffeinated ☕. Approach with caution 🚧.
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxFormBuilder won't build what I want

Post by DavidHart »

Hi,

Unless it's been fixed recently (I've not used it for a couple of years) wxFB stupidly won't let you put a control such as a panel directly into a frame; it insists on frame > sizer > panel. I suspect that's what it's complaining about here.

Regards,

David
User avatar
shawnhcorey
Knows some wx things
Knows some wx things
Posts: 41
Joined: Mon Nov 19, 2012 3:29 pm
Location: The Great White North

Re: wxFormBuilder won't build what I want

Post by shawnhcorey »

In other words, wxFormBuilder is not a very good guide. :(
WARNING: Highly caffeinated ☕. Approach with caution 🚧.
DavidHart
Site Admin
Site Admin
Posts: 4252
Joined: Thu Jan 12, 2006 6:23 pm
Location: IoW, UK

Re: wxFormBuilder won't build what I want

Post by DavidHart »

In other words, wxFormBuilder is not a very good guide
It's second-best IMO (I now use wxCrafter).

However it's easy in wxFB to add a sizer to the frame, and put the panel into it. It does no harm, it's just not needed.
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: wxFormBuilder won't build what I want

Post by New Pagodi »

I love formbuilder, but I suppose it can be a bit picky about what it allows to be a child of certain controls.

Image

I think the only children in allows for notebook pages are panels. So you'll need to add a panel to serve as the page and then add the splitter as a child of that panel.

Incidentally, if the notebook is expanded and stretched and has no border, you could add it directly to the frame's sizer (bSizer1 in the picture above) and skip the application panel (m_panel1 in the picture above).
User avatar
shawnhcorey
Knows some wx things
Knows some wx things
Posts: 41
Joined: Mon Nov 19, 2012 3:29 pm
Location: The Great White North

Re: wxFormBuilder won't build what I want

Post by shawnhcorey »

New Pagodi wrote:I love formbuilder, but I suppose it can be a bit picky about what it allows to be a child of certain controls.
Thanks. Though that seems to be a lot of sizers and panels. :?
WARNING: Highly caffeinated ☕. Approach with caution 🚧.
buttonsrtoys
Experienced Solver
Experienced Solver
Posts: 58
Joined: Mon Jul 03, 2017 12:03 am

Re: wxFormBuilder won't build what I want

Post by buttonsrtoys »

This is an old thread but I'm trying and failing to replicate part of it in wxFB. Specifically, adding a panel to a BoxSizer like shown above:
CaptureWxFB2.JPG
CaptureWxFB2.JPG (23.37 KiB) Viewed 4792 times
But wxFB won't let me add a panel to a BoxSizer. It puts it at the same level as the Frame as shown below:
CaptureWxFB.JPG
CaptureWxFB.JPG (23.55 KiB) Viewed 4792 times
Is there settings or something I need to add to the BoxSizer before it will receive a panel?
New Pagodi
Super wx Problem Solver
Super wx Problem Solver
Posts: 466
Joined: Tue Jun 20, 2006 6:47 pm
Contact:

Re: wxFormBuilder won't build what I want

Post by New Pagodi »

buttonsrtoys wrote:But wxFB won't let me add a panel to a BoxSizer. It puts it at the same level as the Frame as shown below:
CaptureWxFB.JPG
Is there settings or something I need to add to the BoxSizer before it will receive a panel?
Use the wxPanel item under the "Containers" tab.

You're trying the an a Panel item from the "Forms" tab. The items on that tab are meant to be top level windows and can not be children of any other windows.
hpkkumar007
In need of some credit
In need of some credit
Posts: 1
Joined: Wed May 02, 2018 8:55 am

Re: wxFormBuilder won't build what I want

Post by hpkkumar007 »

New Pagodi wrote:
buttonsrtoys wrote:But wxFB won't let me add a panel to a BoxSizer. It puts it at the same level as the Frame as shown below:
CaptureWxFB.JPG
Is there settings or something I need to add to the BoxSizer before it will receive a panel?
Use the wxPanel item under the "Containers" tab.

You're trying the an a Panel item from the "Forms" tab. The items on that tab are meant to be top level windows and can not be children of any other windows.
wxPanel item under the "Containers" tab worked, searched for this solution from few days..
many thanks.. :D
Post Reply