简体   繁体   English

在其他视图上拖动时未释放MouseDragged

[英]MouseDragged not released when dragging on other views

I have 2 subclasses of NSView that are subviews to a common superview. 我有2个NSView子类,它们是一个普通超级视图的子视图。 They dont overlap and they both intercept mousedragged calls. 它们不重叠,并且都拦截鼠标拖曳的呼叫。 When I drag from one of the subclasses to the other the mousedragged function will be called until I release the mouse button even when I drag all over the screen. 当我从一个子类拖动到另一个子类时,即使在整个屏幕上拖动时,也将调用mousedragd函数,直到释放鼠标按钮为止。 I though the default behavior was for the mousedragged function to be called only when the mouse was over the bounds of the receiver. 尽管默认行为是仅当鼠标越过接收器的边界时才调用mousedragged函数。 Iam also using NSTrackingArea for mouse enter, exit and move events, but from what I've been reading does not involve drag events Iam还使用NSTrackingArea进行鼠标进入,退出和移动事件,但是从我一直在阅读的内容来看,不涉及拖动事件

Thank you for your time, Jose. 谢谢您的时间,Jose。

You could subclass the NSWindow and override sendEvent: . 您可以sendEvent: NSWindow并重写sendEvent: That way, you can intercept the NSLeftMouseDragged events and dispatch them in whatever way you wish. 这样,您可以拦截NSLeftMouseDragged事件并以您希望的任何方式调度它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM