setting value in several controls when the value is not a str
(in py3)
When the value is not a string, cocoa/pyObjc tries to localise somehow, fe numbers. This is not nice and different behaviour.
import vanilla
def callback(sender):
v = sender.get()
print(v, type(v))
w = vanilla.Window((400, 400))
w.t1 = vanilla.EditText((10, 10, -10, 22), "1000", callback=callback)
w.t2 = vanilla.EditText((10, 40, -10, 22), 1000, callback=callback)
w.open()
get() and set() are not symmetrical as the output get() is not getting localised.
This behaviour has changed in cocoa and maybe the best advice is to stringify before setting any data in a control, so maybe vanilla should warn if this is happening.
objectValue is maybe not the best option...
To be valid object value, the cell must have a formatter capable of converting the object to and from its textual representation. The value of this property is nil if an object has not been assigned to the cell.
but the cell.formatter() is None, tried to look for a default formatter... but there isn't one
see https://developer.apple.com/documentation/appkit/nscell/1530936-objectvalue?language=objc
The EditText documentation now says that the value should be a string if no formatter is defined. Do you still think we should raise a warning if the value is not a string and there is no formatter? I'm worried about that being very noisy.