Re: returnCode from beginSheetModalForWindow is incorrect?
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