Reputation: 7725
I have a little popup window used for selecting images sorted by groups, and I would like to add a selection box around whatever image is being hovered over. I am trying to this by overriding the mouseMoved event for the window but it seems that a window that has a border-less style mask receives no mouseMoved events even if you have set setAcceptsMouseMoved events to YES. Is there anyway to make a borderless window receive this events?
Upvotes: 2
Views: 955
Reputation: 46020
You need to allow the window to become the key window. By default, borderless windows cannot become key. Subclass NSWindow
and override -canBecomeKeyWindow
:
- (BOOL)canBecomeKeyWindow
{
return YES;
}
Aternatively, you can use an NSTrackingArea
to do your mouse tracking, which may be easier/better anyway.
Upvotes: 5