Sheet in a non-document-based Application
Sheet in a non-document-based Application
- Subject: Sheet in a non-document-based Application
- From: Torsten Trautwein <email@hidden>
- Date: Sun, 12 Mar 2006 07:00:51 +0100
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:
This email sent to email@hidden