• 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: Newbie: Prompt Before Quitting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie: Prompt Before Quitting


  • Subject: Re: Newbie: Prompt Before Quitting
  • From: Esteban Uribe <email@hidden>
  • Date: Wed, 09 Apr 2003 13:43:48 -0700

Hi Chad,

On Wednesday, April 09, 2003, at 11:39AM, Chad Eckles <email@hidden> wrote:

>Hello All Can someone show me how to Prompt the User if he Wants to Quite or
>not when he Closes the Window?

Sure, make your controller class a delegate of NSWindow, and implement
the delegate method - (BOOL)windowShouldClose:(id)sender

Then do your stuff there (call an NSRunAlertPanel, if user says yes [NSApp terminate: nil])

Check out the documentation for it:
NSWindow
<http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSWindow.html#BCIDCAHJ>

NSRunAlertPanel
<http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/ObjC_classic/Functions/AppKitFunctions.html>

NSApplication
<http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/ObjC_classic/Classes/NSApplication.html>

-Esteban
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Newbie: Getting path of file dragged onto NSImageView
  • Next by Date: work around for circular reference retain count limitation?
  • Previous by thread: Re: Newbie: Prompt Before Quitting
  • Next by thread: NSButton>Square Button>No Border Mouse Click Help
  • Index(es):
    • Date
    • Thread