Re: window focus trouble
Re: window focus trouble
- Subject: Re: window focus trouble
- From: Gregor Nobis <email@hidden>
- Date: Tue, 5 Mar 2002 15:44:50 +0100
Date: Mon, 4 Mar 2002 14:57:47 -0800
Subject: Re: window focus trouble
Cc: email@hidden, Gregor Nobis <email@hidden>
To: email@hidden
From: email@hidden
The problem is that you are calling makeKeyAndOrderFront too soon!
Both
applicationWillFinishLaunching and even applicationDidFinishLaunching
are
called BEFORE the regular event loop starts running, so requests like
makeKeyAndOrderFront can't be handled yet. One way around this is to
call a
method with a delay of zero that does the makeKeyAndOrderFront. As
soon
as
event processing gets started your "delayed" code will run, and this
will bring your window to the front.
Hmm, this doesn't sound right to me. I run an NSPanel in the
applicationDidFinishLaunching: method of my app delegate in pretty much
every app I've written in the past year, and I've never experienced a
problem.
Myself, I was gonna guess that the root of the problem lay somewhere
in all the wacky Scheme stuff the guy was doing, and the fact that he
was avoiding using NSRunLoop completely. :-> The Kit kind of relies
on
NSRunLoop being used; it does a lot more than just deliver events to
NSApplication. I don't know for sure that that's the problem with your
app, but if it isn't giving you problems now, it will soon. :-> You
should be able to use -[NSRunLoop runMode:beforeDate:] or the other
similar methods to cycle the run loop, if you really don't want
NSApplication to do this for you.
Ben Haller
Stick Software
That may be a problem, but I have experienced the exact same problem
without any funny event loop stuff. The difference may be that it is
related to my app being kicked off by another app instead of launched
by a
click in the Finder, which would bring an app keyAndFront automatically.
This is when I discovered that a call to makeKeyAndOrderFront (or
becomeKeyWindow or becomeMainWindow) in applicationDidFinishLaunching,
followed by calls to isKeyWindow and isMainWindow always returned NO.
This is really the exact same thing with my app. And just like yours it
does not get started from the Finder but from within that Scheme
process. Where and how do you think I should call that delayed method
you mentioned? I'm not sure I know what you are talking about. I really
appreciate your help - I've been stuck with this stuff for quite a while
now : (
Gregor
_______________________________________________
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.