• 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 wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal)


  • Subject: Re: how to wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal)
  • From: Jens Alfke <email@hidden>
  • Date: Mon, 12 May 2008 17:26:32 -0700


On 12 May '08, at 5:18 PM, Rua Haszard Morris wrote:

Is there a way to wrap up an NSAlert, the beginSheetModalForWindow call, and the alertDidEnd implementation, such that a caller can just call one function which blocks until the alert is dismissed?

No, because the application continues to run and other windows are still able to handle user input.


So if you wrote a routine like this, it would have to run the runloop so events got handled; and then your code associated with actions in other windows could be called re-entrantly down inside your blocking function.

The worst case is if you put up a sheet on one window, then the user does something in another window that puts up a sheet there too. Now you're inside two nested wait-for-sheet-to-finish functions. ...And then the user dismisses the first sheet. Somehow you have to return from the outermost function without returning from the inner one! o_O

The only way to make a programming style like this work is to use a thread per window (as the BeOS did), or coroutines, or something else exotic.

—Jens

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

  • Follow-Ups:
    • Re: how to wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal)
      • From: Rua Haszard Morris <email@hidden>
References: 
 >how to wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal) (From: Rua Haszard Morris <email@hidden>)

  • Prev by Date: how to wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal)
  • Next by Date: Re: how to wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal)
  • Previous by thread: how to wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal)
  • Next by thread: Re: how to wrap an NSAlert so the caller can call one function and get the NSAlert return value (i.e. modal)
  • Index(es):
    • Date
    • Thread