In a table view, I have a couple of "user-defined" columns which the user can click on the header of to pop up a menu of 15 attributes, choosing one for the column to display/edit. Most of the attribute types are strings, several are boolean and one is an array. In my table column's subclass, -dataCellForRow: returns a text field cell, button cell (checkbox) or token field cell, depending on this attribute type.

All this works pretty nice, except that, only when I use bindings, the button cell behavior is readonly. When I click such a checkbox, it flashes, but does not change state. The getter is invoked several times, but the setter is never invoked as long as the data cell is a checkbox. For the text and array attribute types, the setter is invoked and works as expected. In another table which does not use bindings, all attribute types including boolean work fine.

(In order to handle the user-defined key, I have bound these table columns to a key such as 'userDefined0', and then implemented in my "record" class, for example, -userDefined0 and -setUserDefined0:. These in turn dig up the current user-defined key for the column and pass the message thru to the appropriate "regular" accessor.)

I have NSLogged information about the table column in the getter (which always works) and find everything to be as expected when I click the checkbox: The column is editable, -infoForBinding indicates that it is bound to the expected array controller with keyPath arrangedObjects.userDefined0, and the observed object is some kind of NSMutableDictionary, which I believe is normal, some kind of proxy.

Also, I do not see any KVO or KVC complaints in the console log.

I've read lots in the list archives about binding button cells but nothing like this. I was wondering if maybe I needed to "re-bind" the column when the attribute type changed from, say, string to boolean, but the problem occurs even if the table is initialized with the boolean attribute type. And it doesn't seem like this should be necessary anyhow since the widely-used -dataCellForRow: creates and returns a new cell every time data is reloaded. Columns seem to be quite adept at finding their cell.

Sincerely,

Jerry Krinock

_______________________________________________

Cocoa-dev mailing list ([email protected])

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 [email protected]

Reply via email to