Re: window focus trouble
Re: window focus trouble
- Subject: Re: window focus trouble
- From: email@hidden
- Date: Tue, 5 Mar 2002 09:30:11 -0500
From: Howard J. Fink
>
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.
_______________________________________________
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.