• 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: Dismissing Custom Sheets
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Dismissing Custom Sheets


  • Subject: Re: Dismissing Custom Sheets
  • From: Seth Willits <email@hidden>
  • Date: Sat, 27 Mar 2004 14:43:08 -0800

On Mar 27, 2004, at 1:51 PM, Seth Willits wrote:

How are custom sheets dismissed from the sheet's buttons? Are they supposed to connect to first responder somehow? I'd like to run a custom sheet attached to my window have it _not_ be modal to the application, but just the window.

After much fiddling and searching it seems that this is how you do it:


- (IBAction)openSheet:(id)sender
{
[NSApp beginSheet: theSheet
modalForWindow: theParent
modalDelegate: self
didEndSelector: @selector(sheetDidEnd: returnCode: contextInfo:)
contextInfo: nil];
}

- (IBAction)theSheetOK:(id)sender
{
[NSApp endSheet:theSheet returnCode: NSOKButton];
[theSheet orderOut:NULL];
}

- (IBAction)theSheetCancel:(id)sender
{
[NSApp endSheet:theSheet returnCode: NSCancelButton];
[theSheet orderOut:NULL];
}

- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
if (returnCode == NSOKButton)
NSBeep();
}


It seems to behave exactly as I want. Does that look right to you guys?


Seth Willits
------------------------------------------------------------------------ ---
President and Head Developer of Freak Software - http://www.freaksw.com
REALbasic Guru at ResExcellence - http://www.resexcellence.com/realbasic
Webmaster for REALbasic Game Central - http://www.freaksw.com/rbgames

"Lots of folks confuse bad management with destiny."
-- Kim Hubbard
------------------------------------------------------------------------ ---
_______________________________________________
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.


References: 
 >Dismissing Custom Sheets (From: Seth Willits <email@hidden>)

  • Prev by Date: Re: NSTableView tooltips
  • Next by Date: Re: Question about Deprecated Methods
  • Previous by thread: Dismissing Custom Sheets
  • Next by thread: Getting a real bitmap of a compressed JPEG file
  • Index(es):
    • Date
    • Thread