Re: find standard about panel


Jack Brindle
 

The About window has no name - the title is blank.

it would seem that a more interesting way to do the would be to use the [NSWindow windowNumberWithOptions:] method, which does return an array of windows for the app (options = 0) that is ordered in a front to back order. Since you are getting an array of windows you should be able to apply any test you wish too them.

There are other methods, such as [NSApplication windows] that will also give you an array of all application windows, shown or not, but they are not ordered.

Jack

On Mar 13, 2019, at 8:01 PM, Jon Gotow <gotow@...> wrote:

Well, its class is NSPanel rather than NSWindow - is it sufficient to just hide / show all NSPanels in the app's window list when you're deactivated / activated?

Alternately, you can look at all NSPanels and see if any have an NSTextField subview that has a string value equal to the localized name of your app (which you can just grab from NSApp.accessibilityLabel if you don't want to screw around with NSBundle). That's almost certain to be the About box unless you're putting your app's name in a text control in one of your windows :-) Not pretty, but it'd work without too much overhead.

- Jon


On 14 Mar 2019, at 8:41 am, James Walker <list2@...> wrote:

How can I find the window produced by -[NSApplication
orderFrontStandardAboutPanel:]? (I’d like to hide the window when my app deactivates.) I know it’s somewhere in the array -[NSApplication windows], but I don’t know how to identify which one.


Join cocoa@apple-dev.groups.io to automatically receive all group messages.