Code -NSSavePanel, background-only app, "Replace?" alert ordering
Code -NSSavePanel, background-only app, "Replace?" alert ordering
- Subject: Code -NSSavePanel, background-only app, "Replace?" alert ordering
- From: Dave Hersey <email@hidden>
- Date: Sat, 07 Feb 2004 10:58:29 -0500
Oh my, sorry. One more try...
I edited the code for emailing and broke it.
The code should have read:
// Called as: [self reportError: @"Error detail."];
- (void) reportError: (NSString *) errorDetail
{
CFOptionFlags responseFlags;
CFUserNotificationDisplayAlert(0, kCFUserNotificationCautionAlertLevel,
nil, nil, nil,
(CFStringRef) @"An error occurred.",
(CFStringRef) @"Click \"Save Report\" to save an error report.",
(CFStringRef) @"Save Report",
(CFStringRef) @"Cancel",
nil, &responseFlags);
if ((responseFlags & 0x03) == kCFUserNotificationDefaultResponse)
{
NSSavePanel *savePanel = [NSSavePanel savePanel];
int bt;
[savePanel makeKeyAndOrderFront: self];
bt = [savePanel runModalForDirectory: @"/" file: @"Error Report.txt"];
if (bt == NSOKButton)
{
// Save the report.
NSString *newFileString;
newFileString =
[[NSString alloc] initWithFormat: @"echo \'%@\' > \'%@\'",
errorDetail, [savePanel filename]];
system([newFileString UTF8String]);
[newFileString release];
}
}
}
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.