[JavaFX] Bind bug? Or am I just stupid?

I really love that binding stuff in JavaFX. I am looking forward until some smart guy implements something similar in Scala…

But I also have some problems with it. Sometimes “on replace” triggers are called with the same values for <old> and <new>. Here is a small sample script that shows it:

[cc lang="c" escaped="true" tab_size="2" lines="20"]
import java.lang.RuntimeException;

/**
* @author johannes
*/
println( “Starting binding test…” );
var i = 0.5 on replace old {
println( “i changed to <{i}>” );
if ( i == old ) {
throw new RuntimeException( “This will never happen!” );
}
};
var b = bind calc( i ) on replace old {
println( “b has changed from <{old}> to <{b}>” );
if ( b == old ) {
println( “!!!!!!!!!!!!!!!!!!!!!!!” );
println( “Why is on replace called? Both objects are the same: {isSameObject( b, old )}” );
println( “!!!!!!!!!!!!!!!!!!!!!!!” );
}
};

println( “i: {i}” );
i = 0.5;

println( “i: {i}” );
i = 0.9;

println( “i: {i}” );
i = 1.0;

println( “i: {i}” );

function calc( i ) {
return i < 1;
}
[/cc]

Of course I have posted a question in the JavaFX forum. But no answers yet….

UPDATE:
Has finally been fixed in 1.3! Now it works as expected.


4 Responses to “[JavaFX] Bind bug? Or am I just stupid?”

Leave a Reply