0
votes

I have an NSCollectionView in an NSScrollView. The scroll view scrolls horizontally to move along the line of items. Inside each each collection item is a vertically scrolling NSOutlineView.

I have NSButton objects for opening and closing collection items - as supplementary views in my collection. I set up NSTrackingAreas on these buttons to support mouse over effects.

This works correctly, until I scroll, at which point the NSTrackingArea areas are clearly left behind (the mouse over effects happen when the mouse is where the button was, not where it is).

I rebuild my tracking areas in updateTrackingAreas in my button class, and this is called, but not often enough.

I have tried using .inVisibleRect when setting up my tracking areas, rather than explicitly rebuilding them, but that doesn't improve the tracking update.

I have tried calling updateTrackingAreas on the NSCollectionView when scroll occurs, but it is never passed down to the child views as I expected it would.

As a side note, I also have NSTextViews in my collection view items with toolTips that are very flakey too. They are often left hanging. Pointing hand cursors over links are often misaligned.

It feels as though the default updateTrackingArea is over-optimised and is not being called as often as it should.

So, I am about to embark on building my own tracking-area-tracker to register and update my views when they are not updated by default...

...but maybe someone can see something obvious that I am missing? Thank you.

1
A little more testing - the tooltips on NSTextView links do appear to have the same offset as the button tracking area after scrolling.Giles
OK, it appears to be even worse than I thought, because making sure the tracking area is recreated on scroll still doesn't fix the problem. The bounds of the view do not seem to be translated using the parent views properly.Giles
A similar issue seems to have been found here: cocoa-dev.apple.narkive.com/aL6UaipM/…Giles
My test project works ok. How can we reproduce the issue?Willeke
Thank you so much for testing Willeke. Interesting that all works on yours. What layout are you using? I have a subclass of NSCollectionViewFlowLayout. I can try and strip my project back to find the problem. Interestingly, I have NSOutlineViews in my collection items. If I perform a vertical scroll on those, the tracking area positions are all reset correctly. Maybe my scroll wheel filtering is breaking something somewhere...Giles

1 Answers

0
votes

The tracking area setup can be subtly broken when nesting scroll views incorrectly. See the answers regarding nesting scroll views here for details:

NSScrollView inside another NSScrollView