• 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: Similar sheet questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Similar sheet questions


  • Subject: Re: Similar sheet questions
  • From: Jeff Disher <email@hidden>
  • Date: Thu, 9 Jan 2003 19:56:05 -0500

Both of you guys were asking for an answer to approximately the same question so let me answer both here.

First of all you must realize that a sheet is not "modal" in the same way that a normal window is. Where normal windows can be modal for the application, sheets are only modal for their parent window. The difference from a programming perspective is that you can't just write one block of code that creates the modal window and blocks until the modal session ends. Instead, you must tell the sheet to begin and then use either normal action->target methods to handle the dismissing and saving of its contents, the didEndSelector, or the modal delegate functionality.

I will explain the first since it works well in the general case.

To start the NSWindow "sheet" as a sheet for the NSWindow "parentWindow", use this code:
[NSApp beginSheet:sheet modalForWindow:parentWindow modalDelegate:self didEndSelector:NULL contextInfo:nil];

To dismiss the sheet (often as the target selector of some button on the sheet), use this code:
//code to read contents of sheet here
[sheet orderOut:nil];
[NSApp endSheet:sheet];

This will remove the sheet from the window server and tell the application that it can begin receiving events on the parentWindow again.

Hope that helps,
Jeff.


On Thursday, January 9, 2003, at 12:32 PM, Andy Satori wrote:

I want a sheet to pop down, and on completion, I want to read those values
back out from the sheet before disposing of it. What is the correct way to
do this? I am trying to use a SheetDidEnd() function, but when I do that,
the sheet never goes away.

Dru
_______________________________________________
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.


Jeff Disher
President and Lead Developer of Spectral Class
Spectral Class: Shedding Light on Innovation
http://www.spectralclass.com/
_______________________________________________
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.

  • Follow-Ups:
    • Re: Similar sheet questions
      • From: Andy Satori <email@hidden>
References: 
 >Real dumb question... (From: Andy Satori <email@hidden>)

  • Prev by Date: Re: Crash with NSMutableArray and NSNumber
  • Next by Date: Re: Framework Versioning System
  • Previous by thread: Real dumb question...
  • Next by thread: Re: Similar sheet questions
  • Index(es):
    • Date
    • Thread