Re: Sheet in a non-document-based Application
Re: Sheet in a non-document-based Application
- Subject: Re: Sheet in a non-document-based Application
- From: Mike Abdullah <email@hidden>
- Date: Sun, 12 Mar 2006 10:20:03 +0000
The problem is how you're actually showing the sheet, you want to use
NSApp's beginSheet method instead.
Mike.
On 12 Mar 2006, at 06:00, Torsten Trautwein wrote:
Hi everyone,
I have just added an alert sheet to my non-document-based (=single
window) application.
I sticked to Apples Cocoa Documentation. The problem is that the
sheet does not roll out
of the main window like I'd want it to, but it just pops up as a
new window.
This is the code snippet:
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
[alert addButtonWithTitle:@"1"];
[alert addButtonWithTitle:@"2"];
[alert addButtonWithTitle:@"3"];
[alert setMessageText:@"blabla"];
[alert setInformativeText:@"even more bla"];
[alert setAlertStyle:NSWarningAlertStyle];
[alert beginSheetModalForWindow:[NSApp mainWindow]
modalDelegate:self didEndSelector:@selector
(alertDidEnd:returnCode:contextInfo:) contextInfo:nil];
- (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode
contextInfo:(void *)contextInfo {
if (returnCode == NSAlertFirstButtonReturn)
{
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"3"];
} else if (returnCode == NSAlertSecondButtonReturn) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"2"];
} else if (returnCode == NSAlertThirdButtonReturn) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"1"];
}
}
Thanks in advance,
Torsten Trautwein
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40gmail.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden