• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: runModalForWindow() doesn't re-activate former window upon return
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: runModalForWindow() doesn't re-activate former window upon return


  • Subject: Re: runModalForWindow() doesn't re-activate former window upon return
  • From: Ken Thomases <email@hidden>
  • Date: Thu, 25 Aug 2016 10:21:00 -0500

On Aug 25, 2016, at 6:51 AM, Andreas Falkenhahn <email@hidden> wrote:
>
> Isn't runModalForWindow() supposed to activate the window which formerly
> had the focus when it returns? It doesn't do this here. When runModalForWindow()
> returns, the window that was active when I called runModalForWindow()
> isn't made active again.
>
> Of course, I could do this manually by calling makeKeyAndOrderFront()
> on that window after runModalForWindow() returns but I think that it
> would be much more natural if this task was handled by runModalForWindow().
>
> Thus my question: Is this the normal behaviour of runModalForWindow()
> or am I doing something wrong here?
>
> I first thought that this behaviour might be due to my custom application
> setup and event handling but it isn't. I can also reproduce the behaviour
> in a minimal example program. I'm attaching this minimal example program
> for reference. Granted, it doesn't call NSApplicationMain() but I think
> it is nevertheless a good OS X citizen because it does [NSApp run] and
> doesn't do any custom event handling.

Try logging [NSApp mainWindow] and [NSApp keyWindow] in your -buttonPresse: method.  I'm not sure that -makeKeyAndOrderFront: takes full effect before -[NSApplication run] has been called.

What if you move the -makeKeyAndOrderFront: call (and possibly the whole creation of the initial window) into the -applicationDidFinishLaunching: method of an app delegate?

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


  • Prev by Date: Re: Core Graphics: Is it better to up-sample or down-sample images when drawing into a rect?
  • Next by Date: Re: runModalForWindow() doesn't re-activate former window upon return
  • Previous by thread: Re: Set the size of a sheet when it's first loaded
  • Next by thread: Re: runModalForWindow() doesn't re-activate former window upon return
  • Index(es):
    • Date
    • Thread