Re: Issue of NSStatusBar
Re: Issue of NSStatusBar
- Subject: Re: Issue of NSStatusBar
- From: anni saini <email@hidden>
- Date: Wed, 27 Feb 2013 16:45:14 +0800 (SGT)
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 <email@hidden>
To: anni saini <email@hidden>
Cc: "email@hidden" <email@hidden>
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 (email@hidden)
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:
This email sent to email@hidden