static box sizing problems

Robert Anderson rwa000 at gmail.com
Fri Dec 28 11:51:24 PST 2007


On Dec 28, 2007 11:41 AM, chris elliott <biol75 at york.ac.uk> wrote:

>
>
> Robert Anderson wrote:
> > 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
> > right side.  I want the left side to stretch proportionally and I want
> > the right side to be of a fixed width.  Moreover, I want to enclose the
> > right side in a wxStaticBox.
> >
> > I happen to be using wxRuby, but the code should be understandable to
> > C++ programmers.  This is in the constructor of my frame subclass:
> >
> >     lr_sizer =3D BoxSizer.new( HORIZONTAL )
> >
> >     txt =3D StaticText.new (self, -1, "Text Left")
> I think you should add a wxPanel to your frame, and your sizer to the
> panel
>
> chris
>

Chris,

That's what I originally had, but in trying to simplify as much as possible
found it didn't make any difference.  Here's my attempt using a panel
(@panel is an instance variable):


    @panel =3D Panel.new(self, -1)

    lr_sizer =3D BoxSizer.new( HORIZONTAL )

    txt =3D StaticText.new(@panel, -1, "Text Left")

    static_box =3D StaticBox.new(@panel, -1, "Static Box", :size =3D> [100,=
 40]
)
    right_sizer =3D StaticBoxSizer.new( static_box, VERTICAL)
    static_box.set_min_size([ 100, 40 ])

    lr_sizer.add(txt, 1, EXPAND | ALL, 4)
    lr_sizer.add(right_sizer, 0, EXPAND | ALL, 4)

    @panel.set_sizer(lr_sizer)
    layout()

This gives an identical result as described before.  Am I missing something
else?  I have played with various permutations of SetSizeHints() and Fit(),
but nothing seems to do what I want.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wxwidgets.org/pipermail/wx-users/attachments/20071228/8c0=
45d02/attachment-0001.htm


More information about the wx-users mailing list