• 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: Close a alert sheet programatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Close a alert sheet programatically


  • Subject: Re: Close a alert sheet programatically
  • From: Denis Defreyne <email@hidden>
  • Date: Thu, 6 Jan 2005 12:15:05 +0100

I use this code in my app to open a alert:

NSBeginAlertSheet(@"I have a message for you", @"Close", nil, nil,
myWindowOutlet, self, nil, nil, nil, "blah blah blah);

My question is, how do I close this alert programatically, without clicking
on the Close button in the alert?

[NSApp endSheet:[self window] returnCode:blah];

will do the trick. Substitute the return code with NSAlertDefaultReturn for a click on the OK button, NSAlertOtherReturn for Cancel, NSAlertAlternateReturn for the third button. Also see http://developer.apple.com/documentation/Cocoa/Reference/ ApplicationKit/ObjC_classic/TypesAndConstants/AppKitTypes.html.

Regards,

amon-re

--
mail: email@hidden
web: http://www.amonre.org/

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


References: 
 >Close a alert sheet programatically (From: "Peter Karlsson" <email@hidden>)

  • Prev by Date: Close a alert sheet programatically
  • Next by Date: Re: Undo logic location?
  • Previous by thread: Close a alert sheet programatically
  • Next by thread: Re: Close a alert sheet programatically
  • Index(es):
    • Date
    • Thread