jeanlain
jeanlain

Reputation: 418

Appkit: tracking rectangles outside visible rect interfere with other views

Some NSView subclasses have tracking rectangles that update the cursor. This is the case for NSTableHeaderView, which sets the resizing cursor when the mouse hovers a column separator.

These tracking rectangles show outside the visible rectangle of the view. Typically, an NSTableHeaderView is inside an NSScrollView. If the clipped part of the table header is behind another view next to it, tracking rectangles cause cursor updates when the mouse is inside this other view. This would disturb the user.

I suppose this is expected behaviour, but I'm surprised that NSTableHeaderView (as well as NSTableView) doesn't discard tracking rectangles that aren't in the visibleRect

What's the best solution to remove these unwanted tracking rectangles? I'm thinking about overriding -updateTrackingAreas and removing any tracking area that isn't in the visible rect, after calling super. I'm assuming the problematic NSView subclasses uses this method to update tracking rectangles.

Upvotes: 0

Views: 77

Answers (0)

Related Questions