Re: Similar sheet questions
Re: Similar sheet questions
- Subject: Re: Similar sheet questions
- From: Andy Satori <email@hidden>
- Date: Thu, 09 Jan 2003 20:14:24 -0500
This may sound like a silly question, but from code maintainability
standpoint, wouldn9t this create a situation where you would have a panel
and a window sharing a single controller? Is the didEndSelector a little
more elegant (admittedly, I can't make that actually work, it just sits
there and looks at my stupidly)
Andy Satori
On 1/9/03 7:56 PM, "Jeff Disher" <email@hidden> pounded the
keyboard to produce:
>
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.