tags:

views:

59

answers:

1

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?

+1  A: 

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.

Rob Keniger
Thanks a lot that did the trick. I don't want to use NSTrackingArea because I need to be able to target OSX versions earlier then 10.5.
Mike2012