Re: custom sheet modal to window
Re: custom sheet modal to window
- Subject: Re: custom sheet modal to window
- From: Chuck Soper <email@hidden>
- Date: Sun, 9 May 2004 11:39:08 -0700
That worked. Thanks very much. I have one remaining problem. When I
click on the OK button the sheet goes away fine, but when I hit the
return (or enter) key I have to hit it twice to make the sheet go
away. Do you know why? I have the button's key equivalent set to the
return key (\R) in IB.
Thanks,
Chuck
P.S. It seems like the whole purpose of using sheets is so the
application is not modal. I don't why the documentation would show an
example that locks down the entire application.
And here's my final code:
- (IBAction)about:(id)sender
{
[NSApp beginSheet: aboutSheet
modalForWindow: [parentWindowController window]
modalDelegate: nil
didEndSelector: nil
contextInfo: nil];
// Sheet is up here.
[NSApp endSheet: aboutSheet];
}
- (IBAction)okAbout:(id)sender;
{
[NSApp stopModal];
[aboutSheet orderOut: self];
}
At 1:54 PM -0400 5/9/04, Sherm Pendley wrote:
On May 9, 2004, at 12:49 PM, Chuck Soper wrote:
I'm trying to display a custom sheet that is model to the window
only. I want the rest of the application of remain functional.
Get rid of the app modal calls, and move the code to close the sheet
to the okAbout: action method.
- (IBAction)about:(id)sender
{
[NSApp beginSheet: aboutSheet
modalForWindow: [parentWindowController window]
modalDelegate: nil
didEndSelector: nil
contextInfo: nil];
}
- (IBAction)okAbout:(id)sender;
{
[NSApp endSheet: aboutSheet];
[aboutSheet: orderOut: self];
}
I followed the example here:
http://developer.apple.com/documentation/Cocoa/Conceptual/Sheets/Tasks/UsingCustomSheets.html#//apple_ref/doc/uid/20001290
I've been wondering why people kept mistakenly using
-runModalForWindow: with sheets for *years* now. Literally years -
ever since 10.0. Now I know. What a horrible example!
Looks like I'll be getting acquainted with radar...
sherm--
_______________________________________________
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.
_______________________________________________
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.