List Info

Thread: LayoutConstraints upgrade path




LayoutConstraints upgrade path
user name
2007-09-11 13:52:11
Hey there.

I have an application that I developed with an older branch
of wxruby
some time ago, and I made heavy use of the LayoutConstraints
class.
I've been looking around, but so far haven't found much in
the way of
advice for this scenario.  Is there any existing
documentation as to
updating such applications?

Thanks,
Ess

-- 
SO not teh 1337
_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users

Re: LayoutConstraints upgrade path
country flaguser name
United Kingdom
2007-09-11 16:59:35
Scruffy Poo wrote:
> I have an application that I developed with an older
branch of wxruby
> some time ago, and I made heavy use of the
LayoutConstraints class.
> I've been looking around, but so far haven't found much
in the way of
> advice for this scenario.  Is there any existing
documentation as to
> updating such applications?
>   
I haven't seen any such documentation unfortunately.

The upgrade path is to use Wx::Sizer. These are fully
supported in 
wxRuby and are used by all the major IDE packages so aren't
going anywhere.

I haven't used LayoutConstraints so don't really know how
these classes 
work beyond the limited documentation. But from skimming:

- Where you want to position one widget in top-bottom or
left-right 
sequence to another, instead of using
LayoutConstraint#left_of etc, with 
Sizers you create a BoxSizer with Wx::VERTICAL or
Wx::HORIZONTAL, and 
then add widgets to it in the order you want them to
appear.

- Where you want to size one widget relative to one another,
you pass 
proportion arguments to Sizer#add. So if you want one widget
to be twice 
the size of the other, you give the larger widget proportion
2, the 
other proportion 1. You can use proportion 0 to give a
widget a minimum 
"natural" size and retaining that size as the
containing parent is resized.

There is a Sizer tutorial on the wxRuby wiki which is a bit
dated but 
might help. Also you might look into the "arrange"
methods of wxSugar 
which make working with Sizers simpler and more reliable.

hth
alex

_______________________________________________
wxruby-users mailing list
wxruby-usersrubyforge.org
ht
tp://rubyforge.org/mailman/listinfo/wxruby-users

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )