Hi,
inside a control skin I have the following code pattern:
protected void layoutChildren(...)
{
super.layoutChildren(...);
Node child1 = ...
Bounds bip = child1.getBoundsInParent();
if (!animating) {
Node child2 = ...
child2.setTranslateX(bip.getMinX();
child2.setPrefWidth(bip.getWidth());
}
}
The skin scene graph looks roughly like this:
VBox
HBox { ..., child1, ...}
child2
...
Everything is layouted just fine but I want to adjust child2.translateX
and prefWidth based child1 bounds. This does not work initially because
boundsInParent returns zero components leading to incorrect initial
display of the control.
Seems as if boundsInParent is not yet updated. I guess I could use a
binding for that but it would conflict with an animation I also have on
translateX and prefWidth.
Maybe there is a better time to make those adjustments on child2?
Rgds
Werner