• 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: ( NSAlert ) - Creating a Display Alert with a 10 second time out
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ( NSAlert ) - Creating a Display Alert with a 10 second time out


  • Subject: Re: ( NSAlert ) - Creating a Display Alert with a 10 second time out
  • From: Shane Stanley <email@hidden>
  • Date: Mon, 21 Feb 2011 16:16:52 +1100
  • Thread-topic: ( NSAlert ) - Creating a Display Alert with a 10 second time out

On 21/2/11 3:52 PM, "Paul G" <email@hidden> wrote:

> Can NSAlert be given a timeout option somehow?

The easy way is to go to
<http://www.macosxautomation.com/applescript/apps/helpers.html>, download
Myriad Helpers, add NSAlert+MyriadHelpers.h and NSAlert+MyriadHelpers.m to
your project, and use something like:

  tell current application's NSAlert to set theAlert to
makeAlert_buttons_text_("An alert", {"Cancel", "OK"}, "Further explanation")
  tell theAlert to showModalWait_(5) -- returns name of the button, or "Gave
up"

The hard way is to create an NSAlert, set up a timer to call abortModal() on
the alert, add the timer to the main run loop in NSModalPanelRunLoopMode,
show the alert as a modal alert, and be ready to invalidate the timer if the
user clicks on your button.

Your choice...

--
Shane Stanley <email@hidden>
'AppleScriptObjC Explored' <www.macosxautomation.com/applescript/apps/>


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
applescriptobjc-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >( NSAlert ) - Creating a Display Alert with a 10 second time out (From: Paul G <email@hidden>)

  • Prev by Date: ( NSAlert ) - Creating a Display Alert with a 10 second time out
  • Previous by thread: ( NSAlert ) - Creating a Display Alert with a 10 second time out
  • Index(es):
    • Date
    • Thread