• 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: Cocoa Custom NSCell Binding Issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Custom NSCell Binding Issue


  • Subject: Re: Cocoa Custom NSCell Binding Issue
  • From: Hamish Allan <email@hidden>
  • Date: Sat, 14 Jan 2006 16:36:06 +0000


On Fri, 13 Jan 2006 10:06:33 -0800, mmalcolm crawford wrote:

On Jan 13, 2006, at 9:31 AM, Sean Willson wrote:

this looks very promising. i really didn't mean this conversation to turn into a RTFM moment. i really have been digging into the manuals.

The manuals, though, make it clear that this:

When the rating changes it calls setRating. I have tried calling the did and will notifiers hoping that the NSArrayController is listening to it but objectValue never gets called when it changes.

should not be expected behaviour.

Indeed, but what should the expected behaviour be? He tried this after the behaviour he expected did not work:


On Thu, 12 Jan 2006 03:09:37 -0800, Sean Willson wrote:

- As the rating is changed based on user selection I fire off the "rating" KV notification. Yes, I know this rating is different than Object A. I have also tried firing off the "objectValue" change notification in hopes that the NSArrayController would be bound to that key in my object. nada ...

On Fri, 13 Jan 2006 10:06:33 -0800, mmalcolm crawford wrote:

Views observe controllers which observe models, so there should be no reason for an array controller to "listen" for changes in a cell. Views communicate changes (within themselves) to controllers using key-value coding.

If you implement a custom cell, you override -[NSCell setObjectValue:] to make the cell reflect the value of whatever it is bound to.


By symmetry, this would lead me to believe that when a custom cell is manipulated to change an existing value, somewhere along the line, - [NSCell objectValue] would have to be called to obtain the new value.

This seems to happen for NSTextFieldCell, for instance, but not for NSSliderCell.

This is obviously how Sean expected it to work as well. Anyway, if that's not how it works, how, when you're implementing a custom cell, is the change signalled?

For instance, the following is the flow of control when a bound NSSliderCell is manipulated inside a table. What causes the - [NSControl sendAction:to:] to occur?

#0 0x0003ed98 in -[TableEntry setNumber:] at TableEntry.m:56
#1 0x9296fe04 in _NSSetObjectValueAndNotify
#2 0x9296fb30 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
#3 0x93b65018 in -[NSArrayController _setMultipleValue:forKeyPath:atIndex:]
#4 0x938e0050 in -[NSBinder _setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotAppli cableKeys:error:]
#5 0x93b4da48 in -[NSBinder setValue:forBinding:atIndex:error:]
#6 0x93b5b72c in -[_NSValueBinderPlugin applyObjectValue:forBinding:operation:needToRunAlert:error:]
#7 0x93b542d8 in -[NSValueBinder _applyObjectValue:forBinding:canRecoverFromErrors:handleErrors:typeOfAle rt:discardEditingCallback:otherCallback:callbackContextInfo:didRunAlert: ]
#8 0x93b54798 in -[NSValueBinder applyDisplayedValueHandleErrors:typeOfAlert:canRecoverFromErrors:discard EditingCallback:otherCallback:callbackContextInfo:didRunAlert:]
#9 0x93b5539c in -[NSValueBinder performAction:]
#10 0x93b411a4 in -[_NSBindingAdaptor _objectDidTriggerAction:bindingAdaptor:]
#11 0x93b41350 in -[_NSBindingAdaptor objectDidTriggerAction:]
#12 0x9372d180 in -[NSControl sendAction:to:]
#13 0x9372d084 in -[NSCell _sendActionFrom:]
#14 0x9374709c in -[NSCell trackMouse:inRect:ofView:untilMouseUp:]
#15 0x938bea78 in -[NSSliderCell trackMouse:inRect:ofView:untilMouseUp:]
#16 0x93748440 in -[NSTableView mouseDown:]
#17 0x936e7eb0 in -[NSWindow sendEvent:]
#18 0x93690ef4 in -[NSApplication sendEvent:]
#19 0x93688330 in -[NSApplication run]
#20 0x93778e68 in NSApplicationMain
#21 0x0000dfac in main at main.m:13


Thanks,
Hamish

_______________________________________________
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


  • Follow-Ups:
    • Re: Cocoa Custom NSCell Binding Issue
      • From: mmalcolm crawford <email@hidden>
    • Re: Cocoa Custom NSCell Binding Issue
      • From: Sean Willson <email@hidden>
  • Prev by Date: Re: Cocoa-dev Digest, Vol 3, Issue 58
  • Next by Date: NSMutableData: Adding One char to a NSMutableData Object
  • Previous by thread: Re: Cocoa Custom NSCell Binding Issue
  • Next by thread: Re: Cocoa Custom NSCell Binding Issue
  • Index(es):
    • Date
    • Thread