How to use the wxFlexGridSizer? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

How to use the wxFlexGridSizer?

Post by Sunsawe » Sat Aug 01, 2009 9:19 am

Hi,

I would like to achieve something I think being pretty simple.
On a panel, I have a wxTreeCtrl on its right a simple panel and under it a button.

The idea is that the button should always be minimal and the rest of the space should be split in between the treectrl and the panel as 3/4 for the first, 1/4 for the other.

this is the code I am using :

Code: Select all

main_sizer = new wxFlexGridSizer(2,2,1,1);

    tree = new wxTreeCtrl(this, TEST_TREE);
    button = new wxButton(this, TEST_BUTTON, _("Test"));
    pan = new wxPanel(this,wxID_ANY);

    main_sizer->Add(tree,3,wxEXPAND,0);
    main_sizer->Add(pan,1,wxEXPAND,0);
    main_sizer->Add(button);

    SetSizer(main_sizer);
But with this code...from startup everyting is set to the size of the button and is not resized with the window. If I replace the wxFlexGridSizer with a wxGridSizer then at startup the whole space is filled and everything is resized with the window.

What am I doing wrong?

Auria
Site Admin
Site Admin
Posts: 6695
Joined: Thu Sep 28, 2006 12:23 am
Contact:

Post by Auria » Sat Aug 01, 2009 4:02 pm

Try making appropriate column/rows growable :

http://docs.wxwidgets.org/stable/wx_wxf ... rowablecol
"Keyboard not detected. Press F1 to continue"
-- Windows

Sunsawe
Experienced Solver
Experienced Solver
Posts: 54
Joined: Tue Jan 30, 2007 5:04 pm

Post by Sunsawe » Sat Aug 01, 2009 10:18 pm

wow, I have to admit that I obviously did not understand anything to "how to use the wxFlexGridSizer".
I had to check other post talking about these growable rows to understand the way they work.

Eventually, I found out.

Thanks for you hint.

Post Reply