• 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
Sheet in a non-document-based Application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Sheet in a non-document-based Application
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Re: NSLog(@"%@",[NSProxy class]);
  • Next by Date: Sheet in a non-document-based Application
  • Previous by thread: Re: what is a SANE comp? and how do I handle it?
  • Next by thread: Re: Sheet in a non-document-based Application
  • Index(es):
    • Date
    • Thread