On Fri, Apr 2, 2010 at 8:25 PM, Jerry Krinock <je...@ieee.org> wrote: > I solved the problem by eliminating all this code and binding my button's > 'enabled' binding instead to the array controller's 'selection' and, to my > surprise, it worked. My surprise is because, according to superclass > NSObjectController documentation, 'selection' returns NSNoSelectionMarker > when there is no selection, not nil which is what my NSIsNotNil value > transformer would expect.
While this works (I imagine that -[NSButtonCell setObjectValue:] treats NSNoSelectionMarker specially) I would think that the "right" thing to do would be to subclass NSArrayController and write a -canPerformFoo method. But you would need to self-observe the selection property, which is perilous because -removeObserver:forKeyPath: doesn't take a context argument (another bug every Cocoa developer should file a duplicate of). So you could use MAKVONotificationCenter (or OFBinding, our analogue) to self-observe. Perhaps it would be easier to instead put the -canPerformFoo method on your window controller. --Kyle Sluder _______________________________________________ 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com