Re: NSCollectionView - getting notified of selection change?
Re: NSCollectionView - getting notified of selection change?
- Subject: Re: NSCollectionView - getting notified of selection change?
- From: Roland King <email@hidden>
- Date: Mon, 13 Oct 2008 19:24:39 +0800
On Oct 13, 2008, at 7:02 PM, Graham Cox wrote:
Well... I'm not sure! Perhaps I was just over-thinking it. On
reflection it seems like an ordinary to-one relationship having a
setXXX and XXX pattern. Which is how I originally saw it - but then
when it didn't work I thought it must be more complicated and so - I
guess I talked myself round in circles. Hey-ho.
Oh I've been there, I go there most days actually.
OK, well adding NSKeyValueObservingOptionInitial does indeed invoke
the observer, and I get the initial value. But changing the
selection doesn't produce any more calls to the same method. The GUI
itself is working fine - I click, the selection highlight changes...
so something's weird.
Here's the full code:
<snip>
As you can see, all I want is to disable the OK button when there's
no selection! Shouldn't be that hard...
(Aside: I've noticed some other glitches with the animation in
NSCollectionView (occasionally stuff left unerased) so being a new
class it does appear to be a wee bit buggy. Could this be another?)
well it looked fine to me, that's what I'd have written if I tried
that out. The last thing I'd probably do before reporting it as a bug
is hook up another test button in the interface to a method which just
logged the current value of the selectionIndexes property to prove to
myself that selectionIndexes meant what I thought it meant and was
actually changing as I selected things. Then I'd change the selection
a bit, then hit the button. If it changed in the log, my guess would
be the GUI code isn't updating it in a KVO compliant way.
oh I'd probably also, again as a paranoia test, move the entire
observation registration to that test button so I know it only gets
called after the entire gui is running. I know that on wakeOnNib
everything is hooked up, or should be, but I'd probably try it anyway.
Then when it still didn't work, I'd file it as a bug.
_______________________________________________
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