• 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
observeValueForKeyPath triggered twice when changing column in NSTableView using binding
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: observeValueForKeyPath triggered twice when changing column in NSTableView using binding
      • From: Scott Stevenson <email@hidden>
  • Prev by Date: Re: Bindings: changing model changes some views but not others (NSTableColumn)
  • Next by Date: Re: Bindings between nib files (again)
  • Previous by thread: Re: Bindings: changing model changes some views but not others (NSTableColumn)
  • Next by thread: Re: observeValueForKeyPath triggered twice when changing column in NSTableView using binding
  • Index(es):
    • Date
    • Thread