Tom,
Would this not be an application for Key-Value Observing?

Regards,
Sean

On Thu, Sep 10, 2009 at 2:09 AM, BareFeet <[email protected]>wrote:

> Hi all,
>
> I have a table view with columns bound to an NSArrayController. The user
> can edit the values that appear and it's all working fine.
>
> I have a class called "DataRow" for each row in the table/controller. Each
> DataRow is essentially an NSMutableDictionary with a key for each column
> name. The column names (and therefore dictionary keys) are dynamically built
> according to imported data.
>
> What is the best way to intercept user changes to cells in the table? I
> might want to just record the changes or allow/disallow them.
>
> One way, I figure, is to use this method in my DataRow class:
>
> - (void) setValue:(id)value forKeyPath:(NSString*)keyPath
> {
>        NSLog(@"DataRow setValue:forKeyPath:%@", keyPath);
>        return [super setValue:(id)value forKeyPath:(NSString*)keyPath];
> }
>
> This gives the keyPath as: dataRow.The Column Name of the Edited Cell
>
> Is there a built in way to extract the column name (same at the dictionary
> key), or should I just parse out based on the delimiting "." and hope there
> are no "." in the name?
>
> Or is there a better way altogether to intercept data entry changes?
>
> Thanks,
> Tom
> BareFeet
>
> _______________________________________________
>
> 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/skline1967%40gmail.com
>
> This email sent to [email protected]
>
_______________________________________________

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