def dvListener (splitp:SplitPane) {
// "Cannot resolve overloaded method addListener"
splitp.dividers.addListener {
(o: javafx.beans.value.ObservableValue[_ <: Number], oldVal: Number, newVal: Number) => {
// conditions to capture the variation or whatever
val divposit = newVal
if ... {
println("Position changed:" + divposit)
...
...
}
}
} // end addListener
} // END dvListener
You can treat dividers
as an ObservableBuffer
and use onChange
to listen to changes:
splitp.dividers.onChange{ (buffer, changes) =>
...
}
There is a complete example here:
https://github.com/scalafx/ProScalaFX/blob/master/src/proscalafx/ch06/BufferChangeEventExample.scala
Jarek
--
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/419aaec8-3e40-42a1-aad0-daa057870f8d%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/scalafx-users/CAH5OYqSdkzkhZ5wrriDUmova%3DQgtA-0GZyAkiPB2TDGvHmsLXg%40mail.gmail.com.