I tried this one over on the main wx-users list as well, but thought I
try it here since I am using wxRuby:
I am using wxWidgets 2.8.7 on a linux box using the GTK build.
I have pared down my issue to the simplest case: I am trying to use a
horizontal BoxSizer to split a frame into two sections: a left and
side. I want the left side to stretch proportionally and I want the
side to be of a fixed width. Moreover, I want to enclose the right side
I happen to be using wxRuby, but the code should be understandable to
programmers. This is in the constructor of my frame subclass:
lr_sizer = BoxSizer.new( HORIZONTAL ) txt = StaticText.new (self, -1, "Text Left") lr_sizer.add(txt, 1, EXPAND | ALL, 4) static_box = StaticBox.new(self, -1, "Static Box") right_sizer = StaticBoxSizer.new( static_box, VERTICAL ) lr_sizer.add(right_sizer, 0, EXPAND | ALL, 4) set_sizer(lr_sizer) layout()
This code runs and gives almost what I want. The text appears on the
and the static box on the right. However, the static box is a tiny
What I want is to fix the width of the static box. So I try adding a
argument to the static box constructor:
static_box = StaticBox.new(self, -1, “Static Box”, :size => [100, 40]
But now I get something very unexpected to me. The static box is indeed
wider, but it has the same left hand screen coordinate as it did when it
a sliver, so that the static box is mostly out of the frame. I only see
tiny slice of it. Resizing the frame moves the whole box, so it is
mostly out of the frame. It is as if the static box were positioned
according to the minimum size, and then grown to the right, to respect
requested box size. But this is clearly not what I want. I want the
be sized as requested, and then fit using the spacers.
How do I do that? Note that I tried using a panel inside my frame and
adding everything to the panel, but I got the exact same result.
Thanks for any help.