On Dec 23, 2008, at 12:55 PM, John Nairn wrote:

I can't figure out how to determine the front most window of a document when the neither the document nor the application may be active. The application is when contacting an application from an Apple script. Here is what I tried:

[NSApplication keyWindow] and mainWindow become null when application or document are not main

[NSApplication windows] has list of all windows, but appears to be arbitrary order (or at least switching order of two windows does not change order in the windows array returned by NSApplication). Thus it cannot be used to find which window for a document is first.

I looked for some ordered list of windows but couldn't find it (although Apple Script "windows" property of an application does have them in order)


NSWindowList
Gets information about onscreen windows.


void NSWindowList ( NSInteger size, NSInteger list[] );

Discussion
Provides an ordered list of all onscreen windows. It fills list with up to size window numbers; the order of windows in the array is the same as their order in the window server’s screen list (their front-to- back order on the screen). Use the count obtained by NSCountWindows to specify the size of the array for this function.




Glenn Andreas                      gandr...@gandreas.com
 <http://www.gandreas.com/> wicked fun!
m.o.t.e.s. | minute object twisted environment simulation



_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to