<div dir="auto"><div dir="auto">You're thinking about the docs of the note in the bounds properties I think:</div><div dir="auto"><br></div><a href="https://openjfx.io/javadoc/21/javafx.graphics/javafx/scene/Node.html#boundsInLocalProperty()" target="_blank" rel="noreferrer">https://openjfx.io/javadoc/21/javafx.graphics/javafx/scene/Node.html#boundsInLocalProperty()</a><div dir="auto"><a href="https://openjfx.io/javadoc/21/javafx.graphics/javafx/scene/Node.html#boundsInParentProperty()">https://openjfx.io/javadoc/21/javafx.graphics/javafx/scene/Node.html#boundsInParentProperty()</a></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 9, 2024, 03:28 John Hendrikx <<a href="mailto:john.hendrikx@gmail.com" target="_blank" rel="noreferrer">john.hendrikx@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I'm pretty sure I read somewhere in JavaFX docs, code or website that <br>
binding certain properties which are changed during layout is a really <br>
bad idea, but I can't find where I've seen this.  Anyone know what I mean?<br>
<br>
It was something like: binding the values of a property like <br>
width/height which are changed during layout to another property (which <br>
may in turn affect layout) should not be done, and one should be using <br>
properties like min/pref/max width/height.<br>
<br>
The reason I ask is because I'm running into a weird problem where I'm <br>
binding the value of ScrollPane.viewportBoundsProperty.width to a <br>
Label's text property.  What I noticed is that the Label simply is not <br>
updating correctly, and will display the correct value **BUT** use the <br>
previous value for its width calculation which causes the text to not <br>
fit -- the fact that it is displayed wrong is especially obvious when <br>
the Label's value switches between values like "312.0" and <br>
"313.333333333" where the 2nd value often gets an ellipsis (like <br>
"31...") because its width was computed based on "312.0".  What I see <br>
happening is this:<br>
<br>
- A splitpane is resized (with a scrollpane in it)<br>
- The ScrollPane's viewportBoundsProperty changes (in layoutChildren <br>
code of ScrollPaneSkin), so layout is already running...<br>
- A binding on viewportBoundsProperty.width updates the label text from <br>
"312.0" to "313.33333333"<br>
<br>
However, before that binding is executed, I see a call to <br>
`computePrefWidth` on the Label, which uses the old text (ie. "312.0") <br>
-- there is NO other call to computePrefWidth, so the layout process <br>
continues with an incorrect width value...<br>
<br>
When later the layout code of the Label is called, it concludes that the <br>
current width (based on the text "312.0") is insufficient to display <br>
"313.33333333", and so adds an ellipsis...<br>
<br>
So, I'm thinking this may be "expected" behavior -- I'm binding on a <br>
property that is updated during layout, and then making another change <br>
(to Label.text) which in turn should trigger a new layout.  However, <br>
that doesn't happen, and it just runs in the current layout, where it <br>
then uses part new, part old values (new text, but old width).<br>
<br>
Any insights are appreciated.<br>
<br>
--John<br>
<br>
<br>
</blockquote></div>