NSCollectionView cannot multi select by mouse on El Captain ?

DavidLilleyDavidLilley USMember ✭✭✭
edited October 2015 in Xamarin.iOS

Hi

On 10.8 - 10.10 you could multi select item by drawing a rect with your mouse on NSCollectionView but on El Captain It does not work.

I have modified the sample xamarin sample ( Just change in the Xib to Multiselect) and this works on 10.8 and I presume 10.10 but not 10.11

Attached Sample ScreenShot Mouse Selection on 10.8 ( See Faint Mouse Rect)
Attached Sample MacDatabase Project.

I have been playing around with delegates and mouse Rects but don't seem to be finding the issue.

Anyone have any ideas ?

Answers

  • ChrisHamonsChrisHamons USForum Administrator, Xamarin Team Xamurai
    edited October 2015

    So, from what I can tell from this sample:

    https://developer.apple.com/library/prerelease/mac/samplecode/CocoaSlideCollection/Introduction/Intro.html

    as noted here:

    http://www.cocoabuilder.com/archive/cocoa/217489-selection-in-nscollectionview.html

    The appear to be doing hit testing themselves:

    // Used by our -hitTest: method, below. Returns the slide's rounded-rectangle hit-testing shape, expressed as an NSBezierPath.

    • (NSBezierPath *)slideShape {
      NSRect bounds = self.bounds;
      NSRect shapeBox = NSInsetRect(bounds, SLIDE_SHADOW_MARGIN, SLIDE_SHADOW_MARGIN);
      return [NSBezierPath bezierPathWithRoundedRect:shapeBox xRadius:SLIDE_CORNER_RADIUS yRadius:SLIDE_CORNER_RADIUS];
      }

    • (NSView *)hitTest:(NSPoint)aPoint {
      // Hit-test against the slide's rounded-rect shape.
      NSPoint pointInSelf = [self convertPoint:aPoint fromView:self.superview];
      NSRect bounds = self.bounds;
      if (!NSPointInRect(pointInSelf, bounds)) {
      return NO;
      } else if (![self.slideShape containsPoint:pointInSelf]) {
      return NO;
      } else {
      return [super hitTest:aPoint];
      }

    I'm unsure if Apple changed behavior between versions.

Sign In or Register to comment.