NSSavePanel beginSheetForDirectory:
NSSavePanel beginSheetForDirectory:
- Subject: NSSavePanel beginSheetForDirectory:
- From: Jeremy Dronfield <email@hidden>
- Date: Thu, 1 Aug 2002 19:26:32 +0100
I'm having trouble implementing -beginSheetForDirectory: The only sample
project I can find that uses it is TextEdit, which uses it in a way so
fantastically sophisticated I can't make head or tail of it. Could
somebody suggest how I could replace the following implementation of
-runModalForDirectory: with a sheet?
- (IBAction)saveAllNotes:(id)sender
{
int choice;
NSSavePanel *panel = [NSSavePanel savePanel];
NSMutableString *compiledNotes = //code here which builds the string.
choice = [panel runModalForDirectory:NSHomeDirectory()
file:@"Compiled Notes.txt"];
if (choice == NSOKButton) {
if (![compiledNotes writeToFile:[panel filename]
atomically:YES]) {
NSBeep();
}
}
}
It works, but I want a sheet! I've tried
choice = [panel beginSheetForDirectory:NSHomeDirectory() file:@"Compiled
Notes.txt" modalForWindow:[self window] modalDelegate:self
didEndSelector:nil contextInfo:nil];
which gives me a "void value not ignored as it should be" build error.
I've also tried it without the "choice =" and with the appropriate
-didEndSelector: specified, passing compiledNotes as the contextInfo,
but can't make it work.
-Jeremy
=======================================
email@hidden // email@hidden
The Alchemy Pages:
- fractious fiction at
http://freespace.virgin.net/jeremy.dronfield
_______________________________________________
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.