• 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: How to detect clicks outside of modal window?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect clicks outside of modal window?


  • Subject: Re: How to detect clicks outside of modal window?
  • From: Conrad Shultz <email@hidden>
  • Date: Thu, 03 Nov 2011 09:27:52 -0700

Close the window in its delegate's -windowDidResignKey:.

You will need to architect your app differently, though. Blocking the main thread waiting for the window to close will not work. You instead need to have the appropriate delegate method (e.g. -windowWillClose:) call back into your code (or put whatever you need to do, such as finalizing an update to your model, directly in the delegate method implementation).

(Sent from my iPhone.)

--
Conrad Shultz

On Nov 3, 2011, at 8:58, Vojtěch Meluzín <email@hidden> wrote:

> Thanks. Ok, let's say I'm ok with "not making it modal". All I need is that when I show the window, the "method" that does that must return after the window has closed. So basically it's still the same thing, I just can live with the fact that the window may not be modal and rather closed when gets deactivated. How to do that? Do I need to write my own event loops?
>
> Vojtech
>
>
> Dne 3. listopadu 2011 2:03 Conrad Shultz <email@hidden> napsal(a):
> On 11/2/11 5:46 PM, Vojtěch Meluzín wrote:
> > Ok, folks please forget about the intentions, if they are bad, they will be
> > badly rewarded :).
> > Anyway I need it from Leopard. Is that really so hard to do such a trivial
> > thing in Cocoa???
>
> NSWindow's delegate protocol declares a -windowDidResignKey: method that
> you may also find useful.  But I suspect you are going to have trouble
> because the window is modal; as a result I don't think that will be
> called when you would like.
>
> What you are describing is highly non-standard, and Cocoa behaves in a
> manner to discourage behaviors that users may find confusing or
> unexpected.  A phrase commonly seen on this list is "don't fight the
> framework."
>
> Take note of the HIG's section titled "Embrace Modelessness" - you are
> feeling the nudge of the framework.  I also see that the HIG recommends
> using a panel if possible, just as Scott recommended.
>
> --
> Conrad Shultz
>
> Synthetiq Solutions
> www.synthetiqsolutions.com
>
>
>
>
>
>

_______________________________________________

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

References: 
 >How to detect clicks outside of modal window? (From: Vojtěch Meluzín <email@hidden>)
 >Re: How to detect clicks outside of modal window? (From: Scott Ribe <email@hidden>)
 >Re: How to detect clicks outside of modal window? (From: Vojtěch Meluzín <email@hidden>)
 >Re: How to detect clicks outside of modal window? (From: Laurent Daudelin <email@hidden>)
 >Re: How to detect clicks outside of modal window? (From: Vojtěch Meluzín <email@hidden>)
 >Re: How to detect clicks outside of modal window? (From: Scott Ribe <email@hidden>)
 >Re: How to detect clicks outside of modal window? (From: Vojtěch Meluzín <email@hidden>)
 >Re: How to detect clicks outside of modal window? (From: Conrad Shultz <email@hidden>)
 >Re: How to detect clicks outside of modal window? (From: Vojtěch Meluzín <email@hidden>)

  • Prev by Date: Re: How to detect clicks outside of modal window?
  • Next by Date: Re: How to detect clicks outside of modal window?
  • Previous by thread: Re: How to detect clicks outside of modal window?
  • Next by thread: Re: How to detect clicks outside of modal window?
  • Index(es):
    • Date
    • Thread