• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bindings & NSArrayController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings & NSArrayController


  • Subject: Re: Bindings & NSArrayController
  • From: Tom Birch <email@hidden>
  • Date: Tue, 3 May 2005 18:06:10 +1000


On 03/05/2005, at 17:49:09, Jens Miltner wrote:

Hi list,

I have a an array of dictionaries which are displayed and edited in an NSTableView using an NSArrayController + bindings. This all works fine, except for one issue I haven't yet solved:

Is there a way - using bindings - to set one of the dictionary values (a boolean) whenever any other of the values is edited? Essentially, it's something like an "I changed this value" checkbox for each of the list entries, which should automatically be set whenever the user edits one of the displayed column values.

you can do it but you'd probably have to modify your code to use a custom class instead of a dictionary as the content object for the array controller. Basically what you have to do is write your own "setValue:forKey:" method in that custom class to insert your "I changed this value" flag somewhere else in the dictionary


something like

- (void)setValue:(id)value forKey:(NSString *)key
{
if(![key isEqualToString:@"Modified"])
{
[self setValue:[NSNumber numberWithBool:YES] forKey:@"Modified"];
}
[dict setValue:value forKey:key];
}


- (id)valueForKey:(NSString *)key
{
    return [dict valueForKey:key];
}

I'm pretty sure this will work but it may be horribly flawed :)

cheers,
Tom


</jum> _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40cse.unsw.edu.au


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Bindings & NSArrayController (From: Jens Miltner <email@hidden>)

  • Prev by Date: Bindings & NSArrayController
  • Next by Date: Re: ditto in ObjC or C
  • Previous by thread: Bindings & NSArrayController
  • Next by thread: newbie bindings question
  • Index(es):
    • Date
    • Thread