Re: mouse entered/exited in nscollectionviewitem's view
Re: mouse entered/exited in nscollectionviewitem's view
- Subject: Re: mouse entered/exited in nscollectionviewitem's view
- From: Austin Grigg <email@hidden>
- Date: Sun, 26 Jul 2009 15:02:42 -0400
I'm having a similar problem with my NSCollectionView and I was
wondering what you did with copyWithZone to fix your problem.
I'm trying to allow the user to option-click and have my sub-classed
view in my NSCollectionView item show an NSTextView and then when they
finish editing, hide the NSTextView. I have my custom view reading
the option-click, but how should I delegate out the method to show/
hide the NSTextView used for editing?
Originally I created the NSTextView in IB and set it to hidden, then
created an outlet to it in my sub-classed NSView that is being used by
the collection view item, but the outlet doesn't seem to be copied
because when I call setHidden:YES from my view on the NSTextView,
nothing happens.
Austin
FROM : Benjámin Salánki
DATE : Sat Jul 25 18:36:10 2009
On Jul 24, 2009, at 3:23 PM, Keith Duncan wrote:
>> the setup code only gets called once and then none of the actually
>> displayed views in the collection handle any of my intended mouse
>> tracking.
>
> That's probably because your subclass of NSCollectionViewItem isn't
> getting created for each item. You can override -copyWithZone: to
> confirm this and fix it if need be.
>
> It's also prudent to ask for the mouse moved events to be sent too.
>
Thanks, after doing this I managed to get the results I was looking
for!
>> Could anyone please point me into the right direction where to go
>> on from here?
>> Any help is appreciated.
>
> Yes, you'll also run into a problem when the user uses the scroll
> wheel to move around the collection view. The fix for this one is
> slightly more in depth.
>
> Your view under the mouse will first be send -scrollWheel: and it
> will work it's way up the responder chain to the scroll view from
> there. I inserted my NSCollectionViewItem subclass into the
> responder chain between the item view and it's superview so that the
> controller was sent -scrollWheel: before the scroll view.
>
And how would you go on about doing this? I just spent a couple hours
trying to find a workaround myself, but failed. I have the mouse
position tracking code up and running, but I guess it does not get
called at the right time.
Ben
> In that method I tracked the position of the mouse converting from
> window coordinates to collection view coordinates and determined
> which view the mouse was hovering over. Once you've done that it's a
> simple matter of posting a notification internal to the collection
> view item subclass to coordinate the hovering state between
> controllers so that only one is showing the hovering state at a
> given time.
>
> Keith
>
_______________________________________________
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