Sizer problem
Lothar Behrens
lothar.behrens at lollisoft.de
Tue Aug 7 10:51:22 PDT 2007
Hi,
I have got my changes of my sizer issue nearly done, but I do not
understand the following behaviour:
All my text boxes and labels should resized in X direction (width),
but not in Y direction (height).
My multiline text boxes should resize in both directions.
The expected behaviour happens, but the textboxes are distributed
across the panel, so the distance
of each text box grows, when Y grows (down the srceen). This should
not happen.
I only want the new space (Y) in the panel to be distributed to the
multiline text controls, not to others.
Any ideas ?
Thanks, Lothar
Here is the code (relevant snippets and pseudo code):
void LB_STDCALL lbDatabasePanel::addLabel(char* text, wxSizer* sizer)
{
wxStaticText *label = new wxStaticText(this, -1, wxString(text),
wxPoint());
label->SetName(wxString("lbl_") + wxString(text));
sizer->Add(label, 1, wxALL|wxADJUST_MINSIZE, 5);
}
void lbDatabasePanel::init() {
wxBoxSizer* sizerMain = new wxBoxSizer(wxVERTICAL);
wxBoxSizer* sizerHor = NULL;
// Loop through columns of my query
for(int i = 1; i <= columns; i++) {
sizerHor = new wxBoxSizer(wxHORIZONTAL);
columntype = myquery.getColumnType(i);
switch (columntype) {
case lb_I_Query::lbDBColumnChar:
{
wxTextCtrl *text = new wxTextCtrl(this, -1, "", wxPoint(),
wxDefaultSize);
text->SetName(name);
addLabel(name, sizerHor);
sizerHor->Add(text, 1, wxALL, 5);
sizerMain->Add(sizerHor, 1, wxEXPAND | wxALL, 5);
}
break;
case lb_I_Query::lbDBColumnBinary:
{
wxTextCtrl *text = new wxTextCtrl(this, -1, "", wxPoint(),
wxSize(200, 20), wxTE_MULTILINE);
text->SetName(name);
addLabel(name, sizerHor);
sizerHor->Add(text, 1, wxEXPAND | wxALL, 5);
sizerMain->Add(sizerHor, 1, wxEXPAND | wxALL, 5);
}
} // switch
} // for
}
More information about the wx-users
mailing list