Re: Model change behind NSTreeController's back
Re: Model change behind NSTreeController's back
- Subject: Re: Model change behind NSTreeController's back
- From: Sam Stigler <email@hidden>
- Date: Sun, 6 May 2007 16:27:40 +1000
Thanks; I completely didn't realize that there were more examples
available other than what's available on the ADC website. I looked
at OutlineEdit and my app appears to to be doing everything right in
the code and in the nib, but when I call
insertNewObjectForEntityForName:inManagedObjectContext nothing is
added to the outline view. Even more strangely, my detail view is an
NSTabView whose selectedLabel binding was bound to the selection in
the tree controller via a custom value transformer that I made.
Something that I must have done while trying to fix the first problem
now appears to have broken that binding. (I had found a way to get
around the NSControllerObjectProxy problem, but I now forget what I
did.) The selectedObjects binding isn't working -- it's just
returning an empty around on the first event loop (in gdb), and my
value transformer class isn't even called after that when I select
something in the outline view -- it's like the bindings are
completely out of whack for the outline view.
To try to get my detail view to update anyway, I disconnected the tab
view's binding, and then implemented an IBAction which I connected
to the tree controller (via an IBOutlet for the tree controller).
When I debugged that in gdb, I got some a very strange result:
I typed po [theTree selection] (where theTree is the IBOutlet for
my NSTreeController)
It returned <_NSControllerObjectProxy: 0x3d1e30> , which to me would
indicate that something was there.
I then typed po [theTree selectedObjects]
It returned <NSCFArray 0x3c2540>(
)
Am I missing something something here, or would one think that the
NSTreeController would return nil for selection if nothing was
selected? Plus, I activated the IBAction by clicking on the outline
view -- something has to be selected, right? Or is a quirk of
NSOutlineView that an action is activated before the selection occurs?
Thanks again,
Sam
On May 6, 2007, at 3:40 AM, Conor wrote:
It should update automatically when you call
insertNewObjectForEntityForName:inManagedObjectContext; so I would
double
check your interface builder settings for the tree controller.
Check out /Developer/Examples/CoreData/OutlineEdit especially the nib
settings for the tree controller for an excellent example. They are
actually
using "[outlineTreeController add:sender];" but it will work with
insertNewObjectForEntityForName:. Check out dedentNote: and
indentNote:
methods, you will notice they only modify then NSManagedObject in
Core Data
and the tree controller updates itself as well as the outline view.
Regards,
Conor
http://www.bruji.com/
_______________________________________________
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
_______________________________________________
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