referring to global windows
referring to global windows
- Subject: referring to global windows
- From: Matthias Fripp <email@hidden>
- Date: Sun, 12 May 2002 14:36:13 -0700
I am trying to write an application which gives a list of all open
windows on the system, in their z-order as maintained by the window
manager, and lets me activate any one of them. This seems like it should
be easy, but I'm getting stumped at one point.
First, I used the AppKit functions NSWindowCount and NSWindowList to
build an array of global window numbers in the proper order. The
documentation is a little unclear on whether these are global or local
window numbers, but I'm pretty sure they're global.
The next part is where I'm running into trouble. I'd like to get the
title of the window associated with each of these window numbers. If
they were windows within my application, I could simply use
[[NSApp windowWithWindowNumber: theNumber] title]
and in fact, this works for the one windowNumber that happens to
correspond to my application's window (even though the [NSWindow
windowNumber] documentation says local and global windowNumbers don't
match up). But this doesn't work for windows that are owned by any other
applications, and I can't find any Cocoa function that lets me refer to
windows owned by other applications. Getting a NSWindow reference for
each one would be ideal, because then I could get their titles, check
canBecomeKeyWindow and move them to the front if desired (assuming Cocoa
also provides equivalent functions for non-Cocoa windows). But anything
else that would let me get their titles and move them around would be
great too.
Does anyone have any suggestions about how to do this?
Thanks in advance for your help.
Matthias Fripp
P.S. It looks like I might be able to do something with
NSConvertGlobalToWindowNumber or NSConvertWindowNumberToGlobal, but
those seem to have been removed from the API sometime since NextStep,
and I'm not sure how useful they'd be anyway.
_______________________________________________
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.