problem with wxGridBagSizer

22 views
Skip to first unread message

Django

unread,
Dec 12, 2022, 11:34:48 AM12/12/22
to wx-u...@googlegroups.com
Hi,

I created a pane with wxFormBuilder. wxFormBuilder shows what I expected (see
wxDesigner.jpg).

Then I combined the work from wxFormBuilder into an app and in the app, the
panes don't resize (see wxApp.jpg).

Each panel has a wxGridBagSizer, as well as MainFrame. MainFrame has 1 column
and 3 rows, ButtonPane has 4 columns and 1 row.

Each wxBitmapButton is added like this:
grid->Add(button, wxGBPosition(0, 3), wxGBSpan(1, 1)
, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5);

grid->AddGrowableCol(0);
grid->AddGrowableCol(1);
grid->AddGrowableCol(2);
grid->AddGrowableCol(3);
grid->AddGrowableRow(0);

MainFrame adds the footer (ButtonPane) like this:

footer = new ButtonPane(this);
grid->Add(footer, wxGBPosition(2, 0), wxGBSpan(1, 1)
, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5);

grid->AddGrowableCol(0);
grid->AddGrowableRow(1);

What am I missing to resize ButtonPane to fill whole width of MainFrame?

wxDesigner.jpg
wxApp.jpg

Vadim Zeitlin

unread,
Dec 13, 2022, 10:37:36 AM12/13/22
to wx-u...@googlegroups.com
On Mon, 12 Dec 2022 16:33:34 +0100 Django wrote:

D> I created a pane with wxFormBuilder. wxFormBuilder shows what I expected (see
D> wxDesigner.jpg).
D>
D> Then I combined the work from wxFormBuilder into an app and in the app, the
D> panes don't resize (see wxApp.jpg).

Sorry, it's really difficult to say what you're doing wrong without seeing
a short and self-contained example.

D> MainFrame adds the footer (ButtonPane) like this:
D>
D> footer = new ButtonPane(this);
D> grid->Add(footer, wxGBPosition(2, 0), wxGBSpan(1, 1)
D> , wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxEXPAND, 5);
D>
D> grid->AddGrowableCol(0);
D> grid->AddGrowableRow(1);
D>
D> What am I missing to resize ButtonPane to fill whole width of MainFrame?

E.g. here I just don't understand at all what is going on: is "grid" the
same grid that is used for the rest of the layout? If so, how do you expect
the footer to expand without using a span for it?

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/
Reply all
Reply to author
Forward
0 new messages