Hello,
I have a windowcontroller and coded a
- (void)windowDidBecomeKey:(NSNotification *)aNotification
What I do want to know is which window had the focus before my window
gets the focus. How can I do that?
Thanks and bye - Robert
Robert W. Kuhn - 24 Nov 2004 13:52 GMT
Robert W. Kuhn <robert.w.kuhn@gmail.com> schrieb:
> I have a windowcontroller and coded a
> - (void)windowDidBecomeKey:(NSNotification *)aNotification
>
> What I do want to know is which window had the focus before my window
> gets the focus. How can I do that?
I tried
NSArray * arr=[[NSApplication sharedApplication] orderedWindows];
NSLog(@"%i", [arr count]); //always 1
myWndHadFocus=[arr objectAtIndex:0];
My programm: no window, only a NSStatusitem. myWndHadFocus is now always my
Statusitem :-( (btw. its funny to make a [myWndHadFocus miniaturize:self];
then).
Am I on the wrong way?
Bye - Robert
Simon Slavin - 26 Nov 2004 17:23 GMT
On 24/11/2004, Robert W. Kuhn wrote in message
<slrncq92qu.4hr.robert.w.kuhn@powermac.vermtech.de>:
> I have a windowcontroller and coded a
> - (void)windowDidBecomeKey:(NSNotification *)aNotification
>
> What I do want to know is which window had the focus before my window
> gets the focus. How can I do that?
Two possibilities:
1) Walk the window list and find which window is second from
front.
2) Set up notifications for your other windows and
note which became key (or resigned key) most recently.
Simon.

Signature
Using pre-release version of newsreader.
Please tell me if it does weird things.