[haiku-commits] Re: haiku: hrev45726 - in src: add-ons/translators/tiff add-ons/translators/sgi preferences/backgrounds

  • From: Stephan Aßmus <superstippi@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Sat, 01 Jun 2013 09:34:09 +0200

On 31.05.2013 20:54, Rene Gollent wrote:
On Fri, May 31, 2013 at 2:49 PM, John Scipione <jscipione@xxxxxxxxx> wrote:
I'll try that and see what happens, my fear is that the menu field
will still take up the full available width instead of just taking up
the amount of room needed to display the text, i.e. the menu field
will still be behave as it is in fixed-size mode rather than auto-size
mode.

That would be the whole point of the glue. Initially the layout
manager tries to use the preferred size of each control in the row,
then whatever extra space is left over is distributed across the
controls based on weighting. Since in this case the menu field was by
itself in that row, it got the entire horizontal space allotted to it.
Glue deals with that by implicitly expanding to take over whatever
void is left. If anyone more well-versed in the internals of the
layout kit is reading, and I'm off on some of the details, please let
me know.

I think you would have to also assign the menu field a weight of 0 for your example to work, or else the menu field and the glue would get their equal share of the available space:

.AddGroup(B_HORIZONTAL)
    .Add(fCompressionMF, 0.0f)
    .AddGlue()
.End()

Using alignments might be another option, but I think in this case they would be more difficult to work with, since the size of the menu field is not fixed and one would have to restrict the max size of it dynamically.

Best regards,
-Stephan


Other related posts: