Can you provide some sample code to reproduce the issue?
--
You received this message because you are subscribed to the Google Groups "ScalaFX Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scalafx-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalafx-users/1336833d-a998-4e6a-91d5-b9a6a78351b4%40googlegroups.com.
The way I understand the issue. You put several rectangles into FlowPane and put FlowPane into a ScrollPane. You scroll down and change size of one of the rectangles (add drop shadow). This causes the FlowPane to change layout to accommodate new size of that rectangle. ScrollPane sees that its content changed and resets scroll. I do not know if there is a way to just stop ScrollPane. The options I see:
Do not change the size of your rectangle, render them in a way that you can add highlight (drop shadow) without changing the size of the container.
Wait for the layout to happen and reset ScrollPane back where it was. It is a bit tricky because you need the layout to happen and ScrollPane needs to finish reset. If you do it too early nothing will happen. Here is how the code can be modified to restore scroll position before dialog is displayed:
/** Create and show confirmation Popup */
def alertVideoRemovePopup(vbnode: VBox
) {
// Remember scroll position before making changes to layout
val vvalue = spane.vvalue.value
val dropShadow = new DropShadow() {
color = Color.Blue
spread = 0.4
}
vbnode.effect = dropShadow
// A hack to leave some time for FX to update layout after shadow was added,
// FX will also reset vscroll to 1 after layout
Thread.sleep(100)
// Additional step to help FX do layout before we reset scroll pane to initial vvalue
Platform.runLater { () =>
// Restore scroll position
spane.vvalue.value = vvalue
val alert = new Alert(AlertType.Confirmation) {
println("vvalue in alert:" + spane.vvalue)
initOwner(stage)
title = "Confirm"
headerText = "Header"
contentText = "Are you ok with this?"
}
val result =
alert.showAndWait()
result match {
case Some(ButtonType.OK) => println("OK CLick; spane.vvalue:" + spane.vvalue)
case _ => println("Cancel or closed")
}
}
} // END alertVideoRemovePopup
Below is a GIF with how it works for me
There are probably other ways to to do it too.
Jarek