Re: NSObjectController selection - now you see it, now you don't
Re: NSObjectController selection - now you see it, now you don't
- Subject: Re: NSObjectController selection - now you see it, now you don't
- From: Keary Suska <email@hidden>
- Date: Sun, 8 Mar 2009 15:21:13 -0600
On Mar 8, 2009, at 2:20 PM, Luke Evans wrote:
IIRC, NSObjectController, as a super class has some behavior that
doesn't make sense to an NSObjectControlelr proper. Because of this
it is possible that the selection change has been deferred to the
run loop. You can manually run the run loop to see if this is the
case.
It seems to me that there is no need for you to use -
selectedObjects when there will always be a 1:1 relationship
between the controller content and the selected object.
Yes, naturally if I change my selection code to just look at the
content then indeed everything works fine. However, see below...
I'm not sure about the run loop thing. Although I haven't tried
this in my test app yet, the behaviour in the main app seems to
suggest that changing the content object never updates the
selectedObjects array, except perhaps for the very first time.
After setting the content, but before you check selectedObjects, run:
[[NSRunLoop currentRunLoop] runUntilDate:[NSDate date]];
If that works, then you have the runloop issue. Otherwise, it is
probably a bug and I would file a radar.
Just know that there may be caveats to forcing the runloop like this,
so caveat programmor.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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