On 28.5.2014 18:10, Werner Lehmann wrote:
thanks for the explanation. Feels good to finally understand this ;-)
And while I created a ticket as per your suggestion...
[#RT-37309] VBox: vshrink layout hint similar to vgrow
Probably a property would be better since it doesn't change the behavior
(and Labeled is all over the controls). It calls for a 3-state property
(no wrapping, wrapping only when space available, wrapping), but it's
too late for that unfortunately. Anyway, looks like we have another
candidate for JIRA ;-)
...it seems I can use this as a workaround:
() -> label1.prefHeight(vbox.getWidth()),
Maybe something similar could be made available per label boolean
property. So basically the ability to ask a label to consider wrapping
when calculating its minHeight... I can imagine that this might have
made more sense as a default behavior: if people explicitly ask for
wrapping text, they would probably accept a larger minHeight.
On 28.05.2014 16:17, Martin Sladecek wrote:
the important min/pref/max height is the one with width parameter as
Label is horizontally biased. So while minHeight(width) == 17,
prefHeight(width) == 34.
But in your case, with ListView's prefHeight == 1000, you'll overflow by
over 400px. VBox does evenly subtract these overflow pixels from
children until it gets to their minimum. Which happens in case of the
Vgrow is ignored when shrinking (see javadoc for setVgrow). Currently,
neither VBox nor GridPane allow you define policy for children when the
pane is below it's pref size and children need to be shrunk. Seems like
a good candidate for a Tweak in JIRA. ;-)
If you need to keep your Label at some height, currently you can only
raise it's minHeight, but I understand that in this case it may be
tricky as it depends on the width.