Some n00b questions about Bindings/KV I'm facing:

1) NSArrayController and canRemove, how does it know?
A familiar example to those who ran through Aaron Hillegass' Learning Cocoa Programming.

I have an NSArrayController, an NSButton, and an NSTableView
- NSArrayController's contentArray is an NSMutableArray in a MyDocument class.
- NSButton sends the action 'remove:' to the NSArrayController on click
- The column in NSTableView has a binding to NSArrayController to display 'arrangedObjects.personName'

The last piece is the magical piece that is driving me nutty. The NSButton has a binding enabled = NSArrayController's -(BOOL)canEnable. I can't figure out how the NSArrayController knows when the NSTableView has a row selected.

---------------------
2) requires 'insertObject:in<key>AtIndex' for 'removeObjectFrom<key>AtIndex' to work If I don't implement 'insertObject:in<key>AtIndex' then 'removeObjectFrom<key>AtIndex' is never called. Why? The only reason I can come up with is possibly a shortcut in Cocoa that if insert is not implemented then remove probably isn't either. Which bring me to my next question, how does it know the insert is implemented?
I overrode:
-(BOOL)respondsToSelector:(SEL)aSelector
but it never queries for the insert.  What magic does it work with?

Any help is GREATLY appreciated. I hate magic and I can't seem to figure out the under-workings.

Thanks
G
_______________________________________________

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

Reply via email to