I have a model object with a codeURL property which is readwrite and is an 
NSURL. 

I have an NSTextField in the NSView subclass with the value bound to the 
codeURL property with a custom transform which turns a URL into a string (and 
deals with nil and another edge case). 

The transform is reversible, returns YES for allowsReverseTransform and has an 
implemented reverseTransformedValue: method. 

There's a browse button on the UI which lets the user select a file and then 
sets the stringValue: property of the NSTextField to the url.path of the file 
selected. 

What I expected is that setting the stringValue would invoke the transformer in 
the reverse direction and set the codeURL property to the reverse transformed 
value, thus binding the codeURL property in both directions. 

What actually happens is nothing. The transformer reverse method isn't called 
and the codeURL isn't changed. It works in the forward but not the reverse 
direction. I have a checkbox similarly bound (with no transform) and that works 
fine both ways. 

This is my first foray into bindings .. what could I be doing wrong? Do I need 
to express a simple NSString property on the model object and bind that instead 
and do the NSString/NSURL conversion there? 



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to