NSCountWindowsForContext usage?
NSCountWindowsForContext usage?
- Subject: NSCountWindowsForContext usage?
- From: Bill Cheeseman <email@hidden>
- Date: Thu, 27 Jun 2002 17:56:06 -0400
One of the AppKit functions is NSCountWindowsForContext(). Its documentation
says you pass "int context" in the first parameter and get back in the
second parameter a count of all visible (i.e., on screen) windows for the
application having that context. I get nonsense results from this function.
Am I using it wrong or the discoverer of a bug? (I'm doing this on an
announced but not yet released version of Mac OS X, so the latter is more
likely than usual, I guess.)
This function is listed in the graphics section of the function
documentation, so "context" is presumably a graphics context. The
documentation doesn't say. NSApplication has a "context" method that returns
the application's context as an NSGraphicsContext object, so this is
presumably what the function wants. Why it's supposed to be cast to an int
is anybody's guess, but I see that some other methods specify int, as well.
So I write this code and get back a ridiculous number in windowCount. What's
wrong?
int windowCount;
NSCountWindowsForContext((int)[NSApp context], &windowCount);
The sister function NSWindowCount() is supposed to return a count of visible
windows on the desktop, and it works as advertised.
--
Bill Cheeseman - email@hidden
Quechee Software, Quechee, Vermont, USA
http://www.quecheesoftware.com
The AppleScript Sourcebook -
http://www.AppleScriptSourcebook.com
Vermont Recipes -
http://www.stepwise.com/Articles/VermontRecipes
Croquet Club of Vermont -
http://members.valley.net/croquetvermont
_______________________________________________
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.