Value 0 and "0" bug


Try this:

Value val;
val.setValue(String("0")); // Listener is not called 
// or val.setValue(String("")); // Listener is not called either


Well… is that a bug? If you have two var objects of 0 and “0”, they’re equal, so isn’t it fair to say that no change has actually happened?


Even for the second case ?
For me, empty string and zero are not the same.
And if your string is “0.00” it’s different than “0” for the user who entered it, so the software should treat it as different and react. Else this means the valuetree need to be checked outside of the listener chain, and this is a real pain, since it breaks your nice automated system.

In fact, the more I think about this, the more I think the listener should be called when the type change. It should be up to the developper to actually decide if “0” is equal to 0 or so.
My use case is that the user is specifying a text format in a label (in the configuration dialog) and since I don’t get the callback triggered, it doesn’t work.


Hmm, I guess there is a good argument to say that a type change should trigger it. I’ll see if I can do that.