Re: NSTreeController selection not updating
Re: NSTreeController selection not updating
- Subject: Re: NSTreeController selection not updating
- From: Sam Stigler <email@hidden>
- Date: Mon, 7 May 2007 17:05:42 +1000
A quick update to this: I may have just stumbled upon part of the
reason for it not updating. I just told gdb to "po [theTree
observationInfo]" right after the IBAction was launched, and received
the following result:
<NSCFArray 0x3cacf0>(
<NSKeyValueObservance: Observer: 0x3ba820, Key path: arrangedObjects,
Include old: NO, Include new: NO, Context: 0x0, Property: 0x3be940>,
<NSKeyValueObservance: Observer: 0x3bdca0, Key path:
arrangedObjects.name, Include old: NO, Include new: NO, Context: 0x0,
Property: 0x3ca590>
)
It's somewhat odd to me that the default binding in IB would not
include either the new or the old values in the change dictionary.
I'm going to try to implement a tree controller category overriding
addObserver:forKeyPath:options:context: , and I'll get back to you
with whether that fixed it.
Sam
On May 7, 2007, at 12:48 PM, Sam Stigler wrote:
Hi,
I'm sorry to be posting so many questions to the list recently;
this app I'm working on is driving me nuts. But on to the
question... Does anyone know of a reason why NSTreeController
wouldn't be updating its "selection" binding? I ask because I have
an NSTabView whose selectedLabel is bound to my NSTreeController's
selection through a value transformer that I wrote, and that value
transformer simply does not ever get called after the program
launches. (It gets called twice in succession before I've even
selected anything in the bound outline view, thus returning a NO
SELECTION MARKER each time. I'm using [selection
valueForKey:@"observedObject"]. ) I know when the transformer is
called because I put a breakpoint right at the beginning of it.
At first I thought the problem might be with my transformer, but
then I decided to (without undoing the binding) make an IBAction
for my outline view that basically does the same thing as the
binding and the transformer. I got a NO SELECTION MARKER even
though I could clearly see that something was selected in the
outline view. Trying it with the binding removed got the same
result. The code I'm getting the NO SELECTION MARKER for in my
IBAction is: id selectedItem = [[theTree selection]
valueForKey:@"observedObject"]; .
The binding for the NSOutlineView is: content = (search results)
NSTreeController . arrangedObjects .
The attributes for the NSTreeController are:
Entity Name: OutlineGrouping
Automatically prepares content, Editable, Preserves selected,
Selects inserted objects, doesn't always use multiple values marker
Children key path and leaf key path are specified; count key path
and predicate aren't.
Its only binding is to MyDocument's managedObjectContext.
Thanks again,
Sam
_______________________________________________
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:
40mac.com
This email sent to email@hidden
_______________________________________________
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