find standard about panel


James Walker
 

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.


Graham Cox
 

In Interface Builder, just check the “Hides on Deactivate” checkbox for the panel. That should do it… have you tried it?

—G

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.


James Walker
 

On Mar 13, 2019, at 4:35 PM, Graham Cox <graham@mapdiva.com> wrote:

In Interface Builder, just check the “Hides on Deactivate” checkbox for the panel. That should do it… have you tried it?
The standard About panel doesn’t exist in a nib, it’s synthesized by AppKit.


—G

On 14 Mar 2019, at 8:41 am, James Walker <list2@jwwalker.com> 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.


Jon Gotow
 

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@jwwalker.com> 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.


Graham Cox
 



On 14 Mar 2019, at 1:32 pm, Graham Cox <graham.cox@...> wrote:



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

The standard About panel doesn’t exist in a nib, it’s synthesized by AppKit.


Ah, fair point!

How hard is it then to make your own About box? To bring it up instead of the prebuilt one is a very small change to the ‘About’ menu item, to target a different method.

Making your own About box is part of polishing your app anyway, in most cases.

—G


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@stclairsoft.com> 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@jwwalker.com> 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.



James Walker
 

On Mar 13, 2019, at 8:07 PM, Graham Cox <graham@mapdiva.com> wrote:

How hard is it then to make your own About box? To bring it up instead of the prebuilt one is a very small change to the ‘About’ menu item, to target a different method.

Making your own About box is part of polishing your app anyway, in most cases.
True, but this is a little freeware side project, and I didn’t feel like polishing that much.


James Walker
 

On Mar 13, 2019, at 8:01 PM, Jon Gotow <gotow@stclairsoft.com> 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.
There are other NSPanels, that’s not sufficient.

What I came up with was to find an array of visible windows before calling orderFrontStandardAboutPanel:, find an array of visible windows afterward, and whatever’s in the second list but not the first must be the About panel.