When using a popup button in an table column, the 'content' binding may be bound to an array giving the items in the menu. Furthermore, the array contents may be different in different rows.
Example: Consider a veterinary application with a table of "Sick Animals", containing a table column named "Broken Limb". For a row representing a bird, the popup menu items should be: Left Wing Right Wing Left Leg Right Leg For a row representing a dog, the popup menu items should be: Left Front Leg Right Front Leg Left Rear Leg Right Rear Leg Now for a long time I was implementing a tree of +keyPathsForValuesAffectingFoo methods to ensure that the change to the array would be observed when the type of animal, etc. changed. After getting this to work for 90% of the cases, I found that it works 100% if I simply implement -availableBrokenLimbs to compute the current menu items *on the fly*, based on the current state for that row. Whenever the user clicks the popup, the system must be invoking -menuNeedsUpdate:, which must invoke the -availableBrokenLimbs getter to which the 'content' is bound. And, apparently, it does so unconditionally, regardless of whether or not -availableBrokenLimbs has registered a change with KVO since the last click. This seems quite sensible, but I wonder if this behavior could ever change? (I realize that I still need some business logic to update the selection. For example, when the Animal type is changed from Bird to Dog, if the "Broken Limb" value is "Left Wing", it must be changed to some other default value. But this business logic is necessary even if -availableBrokenLimbs were being observed by KVO in the usual way.) _______________________________________________ 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