Richard,

since I need to get x and width of child1 (the one inside the hbox) I have to use boundsInParent. According to the docs layoutBounds.x/y are always zero for resizable nodes so it does not work here. As to the question whether the parent might be size 0: the HBox is indeed size 0 after the initial call to super.layoutChildren. The containing VBox has some 800x400 px though.

I think the reason is probably in Martin's reply although I may not like it ;-)

Werner

On 25.07.2014 18:56, Richard Bair wrote:
Hmmm. The first question I have is whether boundsInParent is really
what you want to use, vs. layout bounds. But assuming it is what you
want, why are the bounds zero? This is during the layout pass, which
is the right place to be doing what you’re doing. The super
layoutChildren call will size everything based on the contentX,
contentY, contentWidth, contentHeight
(http://hg.openjdk.java.net/openjfx/8u-dev/rt/file/4b8d06211312/modules/controls/src/main/java/javafx/scene/control/SkinBase.java).
Is it possible that the parent itself is size 0? boundsInParent
should always be invalidated automatically whenever the
width/height/transforms/etc changes. If not that is definitely a bug
(that you can write a simple test case for to prove).

But my first guess is maybe the parent is size 0 as well, due to
something else (maybe the pref size of the control is 0 to start with
or something…)

Richard

Reply via email to