• 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
Re: returnCode from beginSheetModalForWindow is incorrect?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: returnCode from beginSheetModalForWindow is incorrect?


  • Subject: Re: returnCode from beginSheetModalForWindow is incorrect?
  • From: Jeremy Dronfield <email@hidden>
  • Date: Fri, 18 Mar 2005 10:14:23 +0000


On 17 Mar 2005, at 10:54 am, Geert B. Clemmensen wrote:

The returnCode value should supposedly refer to the documentation for NSAlert, but it doesn't.

Yes it does. Previously I've mostly used -[NSAlert runModal] which returns the correct return codes defined in NSAlert. So I just tested it with -beginSheet... like so:


- (void)runWarning
{
NSAlert *warningAlert = [[[NSAlert alloc] init] autorelease];
[warningAlert addButtonWithTitle:@"Go Ahead"];
[warningAlert addButtonWithTitle:@"Cancel"];
[warningAlert setMessageText:@"Do something with the selected files?"];
[warningAlert setInformativeText:@"(You can switch off this warning in Preferences)"];
[warningAlert setAlertStyle:NSWarningAlertStyle];
[warningAlert beginSheetModalForWindow:myWindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil];
}


- (void)alertDidEnd:(NSAlert *)alert returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
NSLog(@"returnCode:%d", returnCode);
[[alert window] orderOut:nil];
}


The log output:

2005-03-18 09:56:51.752 AnApp [471] returnCode:1000 << clicked "Go Ahead"
2005-03-18 09:56:56.684 AnApp [471] returnCode:1001 << clicked "Cancel"


Exactly as defined in NSAlert.h and described in the NSAlert documentation. Where's the problem?

Regards,

-Jeremy

===================================
SkoobySoft, home of viJournal and Skooby Renamer
email: email@hidden or visit:
http://freespace.virgin.net/jeremy.dronfield/skoobysoft/skoobysoft.html
===================================

_______________________________________________
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: returnCode from beginSheetModalForWindow is incorrect?
      • From: "Geert B. Clemmensen" <email@hidden>
References: 
 >returnCode from beginSheetModalForWindow is incorrect? (From: "Geert B. Clemmensen" <email@hidden>)
 >Re: returnCode from beginSheetModalForWindow is incorrect? (From: Jeremy Dronfield <email@hidden>)

  • Prev by Date: Re: multidimensional arrays
  • Next by Date: Re: Reading .BMPs the hard way
  • Previous by thread: Re: returnCode from beginSheetModalForWindow is incorrect?
  • Next by thread: Re: returnCode from beginSheetModalForWindow is incorrect?
  • Index(es):
    • Date
    • Thread