Sizerproblems with wxComboBox 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
phlox81
wxWorld Domination!
wxWorld Domination!
Posts: 1387
Joined: Thu Aug 18, 2005 7:49 pm
Location: Germany
Contact:

Sizerproblems with wxComboBox

Post by phlox81 »

I am having a dialog, which contains a wxComboBox.

The Dialog is layouted pretty good, so the combobox has the right size.

Now, the combobox shows values from the program, and if they are "longer" then the combobox width, the combobox expands, and breaks the whole layout.

I thought, fine, call SetMaxSize and you're done, but it does not work:

Code: Select all

cbb_filename = new wxComboBox(this, ID_COMBOBOX2, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_COMBOBOX2"));
	cbb_filename->SetMaxSize(wxSize(130,-1));
So, this code does not effect the combobox size. Its getting bigger then this, also replacing wxSize(...) with GetSize() of the combobox does not help.

So, how can I make this combobox always stay the same size?

phlox
TrV
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 630
Joined: Wed Jul 04, 2007 1:12 pm

Post by TrV »

Maybe could you try to set the "max" size when constructing the object, replacing "wxDefaultSize".

Could you give the code referring to panel and sizer for this combobox please ?
lester
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 211
Joined: Sat Sep 02, 2006 7:24 pm
Location: Ukraine

Re: Sizerproblems with wxComboBox

Post by lester »

cbb_filename->SetMaxSize( wxSize( 130, -1 ) );
cbb_filename->GetParent()->GetSizer()->Layout();
phlox81
wxWorld Domination!
wxWorld Domination!
Posts: 1387
Joined: Thu Aug 18, 2005 7:49 pm
Location: Germany
Contact:

Post by phlox81 »

The sizer seems to ignore the max size, if wxEXPAND is in its flags.
Removing this and setting the defaultsize to 130,-1, solved it.
Post Reply