Re: Window Loses Mouse Moved Events After Selecting From Menu (SOLVED)
Re: Window Loses Mouse Moved Events After Selecting From Menu (SOLVED)
- Subject: Re: Window Loses Mouse Moved Events After Selecting From Menu (SOLVED)
- From: Henry McGilton <email@hidden>
- Date: Tue, 7 Oct 2003 22:57:45 -0700
On Tuesday, October 7, 2003, at 12:31 PM, Henry McGilton wrote:
I have an invisible background window/view combination that
tracks the mouse all over the screen and sends mouse coordinates
to two other windows in the application. Everything has been working
fine up to now.
However, when I select some action from my application's menu,
the background window/view no longer sees the mouseMoved events.
In the action method that is called from the menu, I have tried
making the background window the key window, and specifically
have told the background window to make its content view the
first responder.
Thanks to Kristin Webster at Apple for suggesting a solution to this
problem.
Turns out when you select an action from a menu, the menu machinery
eats the mouseMoved events, and when the action is finished, your
application windows never gets any more mouseMoved events.
The solution is, at the end of the action method, I send the
background window four messages. The first two are to re-establish
the background window as the key window, and re-establish the
background window's content view as the first responder:
[backgroundwindow makeKeyAndOrderFront: self];
[backgroundwindow makeFirstResponder: [backgroundwindow
contentView]];
And then, I need the background window to re-establish the state that it
is accepting mouseMoved events, by sending these two messages:
[backgroundwindow setAcceptsMouseMovedEvents: NO];
[backgroundwindow setAcceptsMouseMovedEvents: YES];
in succession, which forces the window to change its state, and
then, after my action method returns, the background window/view
start tracking mouseMoved events properly.
Best Wishes,
........ Henry
===============================+============================
Henry McGilton, Boulevardier | Trilithon Software
Objective-C/Java Composer | Seroia Research
-------------------------------+----------------------------
mailto:email@hidden |
http://www.trilithon.com
|
===============================+============================
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.