How do I disable drag and drop on NSTextView? -
i have nswindowcontroller contains several nsviewcontrollers. universally accept drag , drop events nswindowcontroller class , not intercepted other views such nstextview (contained in nsviewcontroller)
how can tell nstextview ignore drag & drop event?
i found out there 2 things needed skip past nstextview's interception of drag , drop event.
in nsviewcontroller containing nstextview:
- (void)awakefromnib { [self nodraginview:self.view]; } - (void)nodraginview:(nsview *)view { (nsview *subview in view.subviews) { [subview unregisterdraggedtypes]; if (subview.subviews.count) [self nodraginview:subview]; } } now subclass nstextview , add method:
- (nsarray *)acceptabledragtypes { return nil; } the nstextview should ignore drag , drop event , leave handled nswindow.
Comments
Post a Comment