开发者

How to make NSWindow accept mouseMove events immediately after opening?

I am writing an application using cocoa which, in some point (surprise), opens window.

There is a "Hover" functionality in this window, and for that I need to accept mouseMoved events. I managed to activate this functionality using

[[newView window] setAcceptsMouseMovedEvents:YES];

call, however, it only starting to work after I touch the opened window, actually activating it this way. I am interested for it to work right away, without clicking on it.

- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent 

does not seem to be working since only mouseDown or mouseDragged events activate it. Apparently mouseMoved event does not.

In other words, mouseMoved ev开发者_开发知识库ent only start to work after mouseDown or mouseDragged event has been called.


Are you using an NSTrackingArea to handle this? Have you passed in the NSTrackingActiveAlways option?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜