• 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
NSSavePanel beginSheetForDirectory:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: NSSavePanel beginSheetForDirectory:
      • From: Ali Ozer <email@hidden>
    • Creating a clickable (web-browser-like) URL control
      • From: Sean McBride <email@hidden>
  • Prev by Date: Re: teaching a game to "speak" different languages
  • Next by Date: Creating a clickable (web-browser-like) URL control
  • Previous by thread: Re: teaching a game to "speak" different languages
  • Next by thread: Creating a clickable (web-browser-like) URL control
  • Index(es):
    • Date
    • Thread