window focus trouble
window focus trouble
- Subject: window focus trouble
- From: Gregor Nobis <email@hidden>
- Date: Mon, 04 Mar 2002 12:30:58 +0100
I'm having trouble with window focus.
From a command-line Scheme interpreter (Scheme 48) I call Scheme code
that in turn calls some ObjectiveC code which is supposed to create and
display a window and order it in front of the terminal window. The ObjC
code consists of a subclassed NSApplication and a delegate to go with
it. Instead of calling [NSApp run] I use an ObjC function that runs a
while loop that imitates the run loop. (It simply gets events from the
event queue and sends them to the application using -sendEvent unless
they're nil) In the delegate's -applicationWillFinishLaunching method a
simple window (containing only an NSTextField) is created and sent
-makeKeyAndOrderFront.
Now comes the funny part: The window gets created and opened all right.
But neither does it order front nor become key. Clicking inside the
window will bring it to the front, the NSTextField inside it gets a
focus ring and everything looks fine. Except:
1) The terminal window's close, resize and minimize widgets remain
colored and it's title bar remains opaque as if it still were in front.
The new window's widgets and title bar do the same. So there seem to be
two frontmost windows.
2) Typing will not result in text added to the NSTextField but text
entered in the Terminal window.
3) To get the window to behave the normal way, you have to click its
title bar. It then gets the keyboard input and the terminal window
becomes a normal inactive window.
To get to know what's going on, I had my code print out all the NSEvents
the app gets and I discovered the following: until you click the title
bar of the new window no events of the type NSSystemDefined occur. No
matter where you click in the window, it only gets NSMouse* and
NSAppKitDefined events. But once you have clicked the title bar an
NSSystemDefined event gets sent along with every click.
Even more irritating is the following behavior: for every event I also
have my code print out the name of the window that generated the event.
And until the window gets the "real focus" this name will change back
and forth between"" and "scheme48vm" (it's real name) with every click
inside the same window.
Anyone got an idea what's causing this? Thank you for your time and
help.
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.