Sizer Question

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
cr_itm
Earned a small fee
Earned a small fee
Posts: 15
Joined: Fri May 06, 2005 4:48 pm

Sizer Question

Post by cr_itm » Tue May 31, 2005 10:20 pm

Hello,

I'm new to the concept of sizers, and I like the mechanism. Just one question:

A horizontal sizer positions its childs horizontally, a vertical sizer positions its childs vertically. But, what if I want two objects (let's say two wxStaticBoxSizers) be aligned vertically (one StaticBox under the other), but expand horizontally?

I use a vertical BoxSizer to align the StaticBoxes under each other. But then thay expand vertically, not horizontally. I want them to not expand vertically, but horizontally.

How can I do this?

I hope I could describe it well enough.

Thanks a lot!

eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco » Tue May 31, 2005 10:31 pm

Use the flag wxEXPAND.

cr_itm
Earned a small fee
Earned a small fee
Posts: 15
Joined: Fri May 06, 2005 4:48 pm

Post by cr_itm » Wed Jun 01, 2005 7:00 am

eco wrote:Use the flag wxEXPAND.
Thanks for the answer, but I used the wxEXPAND flag. Here is my code:

Code: Select all

wxBoxSizer* pSizer1 = new wxBoxSizer(wxVERTICAL);

wxStaticBoxSizer* pSizer1_1 = new wxStaticBoxSizer(wxVERTICAL, p, "Simulation Control");

wxStaticBoxSizer* pSizer1_2 = new wxStaticBoxSizer(wxVERTICAL, p, "Record Simulation");


pSizer1->Add(pSizer1_1, wxEXPAND | wxALL, 5);
pSizer1->Add(pSizer1_2, wxEXPAND | wxALL, 5);

pSizer1_1->Add(pText_SimScript, wxALL, 5);

p->SetSizer(pSizer1);
There are two StaticBoxes, expanding vertically. But they use a minimal width (taking from the with of the static text pText_SimScript), and do not expand horizontally, but I want them to do so.

Can you help me?

Thanks in advance

eco
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 203
Joined: Tue Aug 31, 2004 7:06 pm
Location: Behind a can of Mountain Dew
Contact:

Post by eco » Fri Jun 03, 2005 3:08 am

cr_itm wrote:

Code: Select all

pSizer1->Add(pSizer1_1, wxEXPAND | wxALL, 5);
pSizer1->Add(pSizer1_2, wxEXPAND | wxALL, 5);

pSizer1_1->Add(pText_SimScript, wxALL, 5);
It looks like you are missing a parameter in there (proportion). Try this:

Code: Select all

pSizer1->Add(pSizer1_1, 0, wxEXPAND | wxALL, 5);
pSizer1->Add(pSizer1_2, 0, wxEXPAND | wxALL, 5);

pSizer1_1->Add(pText_SimScript, 0, wxALL, 5);

Post Reply