Re: Window move unknown to NSApp?
Re: Window move unknown to NSApp?
- Subject: Re: Window move unknown to NSApp?
- From: Bob Estes <email@hidden>
- Date: Wed, 2 Mar 2005 15:35:56 -0500
Well, it's not one continuous loop, but the animation does go through a lot of steps called by a single routine that doesn't return until it's done. I want the user to be able to pause and resume the animation. The routine checks for mouse events periodically and tells the app to handle them. If there's been a click on the pause button a flag gets set and the animation does return. It starts again where it left off whenever a click on the resume button signals it to. This works fine so long as the window with the pause/resume button stays put.
The problem is that if I drag the window containing the pause button the window server moves the window without letting the app know about it until the app goes into a listening mode, so to speak. Thus a click on the pause button (after the window has moved as the animation is running) doesn't get registered as hitting the button since the app is unaware that the window has moved. At least this seems to be the case. Is there no way to force the window server to let the app know about the window move? That is what I need.
On Mar 2, 2005, at 2:46 PM, John C. Randolph wrote:
This is just a guess, but are you running this animation in a loop that doesn't return until the animation is done?
-jcr
On Mar 1, 2005, at 7:54 PM, Bob Estes wrote:
Hi, all. I haven't posted to this list before. I don't believe this is a FAQ; if so, I apologize.
I had a problem with a button that would just quit responding for no reason I could think of at first. Now I believe I've determined what is happening, but I don't know how to fix it.
Here's the situation. I have a pause/resume (toggled) button programmed to pause and resume an animation. The button resides in a window separate from the window in which the animation is displayed. Throughout the generation and display of the animation I call
[NSApp nextEventMatchingMask:NSLeftMouseUpMask|NSLeftMouseDownMask untilDate:[NSDate dateWithTimeIntervalSinceNow:0.001] inMode:NSDefaultRunLoopMode dequeue:YES]
to capture mouse events and then process them ([NSApp sendEvent:event];). The button works as expected so long as the enclosing window isn't moved between a resume click and a pause click. By trial and error I determined that the problem was that the new position of the window (and button) was not known to NSApp. It evidently thinks the window is still where it used to be, for If I move the window back to where it was when I clicked resume, pause then works. Of course I could just freeze the window in place, but I'd rather not.
So the question is, how do I tell the app programatically that the window has moved or convey what its new frame is whenever it moves while the computer is otherwise tied up with the animation?
Thanks.
Bob Estes _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden