Re: No mouseExited when switching windows
Re: No mouseExited when switching windows
- Subject: Re: No mouseExited when switching windows
- From: Steve Mills <email@hidden>
- Date: Wed, 20 Feb 2013 09:55:02 -0600
On Feb 19, 2013, at 17:37:26, Shane Stanley <email@hidden> wrote:
> Don't you mean:
>
> [center addObserver:self selector:@selector(windowDidResignKey:)
Doh! Thanks. First time I've used @selector since the early days of Cocoa.
So now I have that working, and am handling mouseEntered, mouseMoved, mouseExited, and cursorUpdate for my control. The only thing that's not yet right is what to do after this series of events:
1. Move the mouse into my control. I hilite a specific area with the "hover" image.
2. Command-` to switch to another window that may or may not intersect with the first window (doesn't matter). I have *not* moved the mouse. I get a windowDidResignKey message, so I remove the hilite.
3. Command-` back to the first window, still without moving the mouse, which is still inside my tracking area.
At this point, I should hilite that same area with the "hover" image. Yet I can't because the only thing I can think of doing the "right" way would be to receive a NSWindowDidBecomeKeyNotification notification. But this doesn't give me the current mouse location. I could ask NSEvent for its global mouse location, but that doesn't sound very Cocoa-y. And I can't save and restore the state because the mouse *could* have moved while the 2nd window was active.
I just wish NSTrackingArea would send mouseExited with the window loses its mainness or keyness (choosable by the owner) and a mouseEntered when becoming main/key. That makes the most logical sense.
--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden