right align in a horizontal sizer

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
Experienced Solver
Experienced Solver
Posts: 70
Joined: Sun Nov 23, 2008 2:32 pm

right align in a horizontal sizer

Post by nkwinder » Tue Feb 24, 2009 12:41 pm

hello all

i have a window in which i want to have a strechable main panel aligned to the left, and an unstretchable sidebar always positioned to the right. This is easily done with a horizontal box sizer.

The thing is that sometimes, the wxPanel which should be on the left, is deleted, so there is only the sidebar shown. So how can i make the sidebar stay on the right, when there is no panel on the left which would have otherwise forced the sidebar stay on the right?


wxWorld Domination!
wxWorld Domination!
Posts: 1059
Joined: Sun Dec 30, 2007 6:40 pm
Location: Canada

Post by JimFairway » Tue Feb 24, 2009 1:36 pm


You try adding a stretch spacer between the panel and sidebar with a proportion value less than the panel but greater than the sidebar.

Hope that helps,

OS: Vista SP1, wxWidgets 2.8.7.

Post Reply