[Y-devel] Widget size negotiation
Lincoln Quirk lincoln at cognitoy.com
Wed Feb 25 03:04:03 GMT 2004
On Tue, 2004-02-24 at 21:29, Thomas wrote:
> On Tuesday 24 February 2004 08:29, Lincoln Quirk wrote:
> > Within each level of widget containment there should probably be an
> > automatic sizing method with propagation. This way, you can resize
> > windows, and everything inside the window will behave optimally in terms
> > of the sizes.
>
> In my opinion, you should be able to choose whether you want this behavior or
> not. This is already implemented to a certain extent in GridLayout, and I
> like this method. If you want your window to resize widgets, use a layout
> that resizes, if not (for whatever reason) you can use something like a Panel
> which would just let you place objects at locations and specify their size
> statically.
Agreed. I would make this the implementation in some layout widget
(NegotiatingGridLayout? something like that) -- not all of them, because
there are certainly times when you don't want that behavior. I was
unclear and I realized it after I sent the post -- that this isn't
something I would expect everybody to use, but it is a common and useful
mechanism.
> My favorite way to do this is by specifying a stretch factor, where the
> highest (or lowest) value gets the most space. ie, sort by stretch factor,
> give the first widget its prefered size, then, if you need to, lower the size
> of the next, etc.
>
> this gives the programmer the most control over what gets space when if he/she
> needs it, otherwise, they can ignore the option (by setting everything to the
> same (defaulted?) stretch factor).
>
> Thomas Stephens
spiralman at softhome.net
Yeah, I think this is helpful - because control to the programmer is
important. StretchFactor should also be in there. But without input from
the programmer, should every item in a large form grow to the same size?
I would like to simply lay everything out on a form and see it work
intelligently, and this method seems to work pretty well for most
applications of that. It works because both minimum size and preferred
size can be determined by the widget's type and other properties (a
single-line textbox has a preferred and minimum height of one line, but
no preferred width whereas a multi-line textbox has no preferred width
or height).
--
More information about the Y-devel mailing list
2026 © www.Y-Windows.Org - All Rights Reserved