Yeah thats true its Apple-private implementation. However, I'm closing windows 
only those are visible in my App and I have checked with title, its only 
closing windows created by my App.
I think, a solution as suggested by you "You can either track them by adding 
and removing them from a list or giving them some unique property so that you 
can distinguish them." is the proper one.

Thanks.

________________________________
 From: Ken Thomases <k...@codeweavers.com>
To: anni saini <anni_sa...@yahoo.com> 
Cc: "cocoa-dev@lists.apple.com" <cocoa-dev@lists.apple.com> 
Sent: Wednesday, 27 February 2013 12:04 PM
Subject: Re: Issue of NSStatusBar
 
On Feb 27, 2013, at 12:59 AM, anni saini wrote:

> I got the solution, just need to check for NSStatusBarWindow className as 
> follows:
> if([awindow isVisible] && ![aWindow aboutWin] && ![aWindow loginWindow] && 
> ![[aWindow className] isEqual:@"NSStatusBarWindow"])

You're relying on Apple-private implementation details that are subject to 
change at any time.  In fact, you can't be sure that all status items use 
windows of that class even now.  That is, it doesn't necessarily require a 
"change" for this to be wrong; it may be wrong right now and just hasn't 
happened to show up in your testing.

Furthermore, you have no reason to assume that status bars are the only 
"secret" windows used by Cocoa.  The whole notion of closing windows which you 
didn't create is irresponsible and inviting trouble.  You shouldn't be doing it.

If you (for reasons which escape me) feel the need to close all of your 
windows, then you have to track all of your windows and close only those.  You 
can either track them by adding and removing them from a list or giving them 
some unique property so that you can distinguish them.

Regards,
Ken
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Reply via email to