observeValueForKeyPath triggered twice when changing column in NSTableView using binding
observeValueForKeyPath triggered twice when changing column in NSTableView using binding
- Subject: observeValueForKeyPath triggered twice when changing column in NSTableView using binding
- From: "Smith, Steven (RSAA Storage)" <email@hidden>
- Date: Fri, 1 Dec 2006 12:01:11 -0700
- Thread-topic: observeValueForKeyPath triggered twice when changing column in NSTableView using binding
I have two columns in an NSTableView (the NSTableView is binded to an
NSArrayController
that's binds to a mutale array(the rows) of mutable dictionaries(the
columns))., one column
is "Amount" and next is "Tally" that holds the running total from the
'Amount" column.
I've tried addObserver for about everything I can find in the
docs/google to update the "Tally" within
"observeValueForKeyPath:ofObject:change:context:" without triggering
observeValueForKeyPath twice.
forKeyPath:@"selectionIndex" or
forKeyPath:@"selection.amount" or
forKeyPath:@"selectedObjects" or et.al.
all trigger "observeValueForKeyPath:ofObject:change:context" twice...
(i've taken out all code that changed "tally" in case there was
something their causing the second trigger.
All parameters in every case are:
object: <NSArrayController .... NSMutableDictionary,... number of
selected objects: 1> <<--- abrevated output of
NSLog(@"object:<@%>",object);
change={kind =1; new = <null>, old=<null>;}
<---NSLog(@"change=@%", change);
context=myPrivateContext
<--NSLog(@"context=@%", context);
This output appears twice for any inserts or edits to "amount" column.
I'm guessing it has to do with with "edit/commitedit" and/or
"change/didchange" type of
messages that cause the double trigger, but I can't find anything to
confirm. I thought
the dictionary values of "change" would have info about what is going
on, but
it always returns kind=1.
Thanks in advance of any help, or pointer to a document that'll explain
it.
Steven
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden