• 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: programmatically setting the file name?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: programmatically setting the file name?


  • Subject: Re: programmatically setting the file name?
  • From: Stéphane Sudre <email@hidden>
  • Date: Thu, 13 Nov 2003 12:16:27 +0100

It looks like NSDocumentController is a bit like Jean-Claude Van Damme, it needs to be Aware of any modification occurring. If you try to change the name of your document, its content outside of the usual architecture, you will fall to this situation.

One workaround is to make your change before the open call. So one solution is to have a blank template, copy it where you want it to be, and then open it. The downfall is that you need to create the file.

On Thursday, November 13, 2003, at 11:42 AM, Jirtme Laurens wrote:

Hi list

I created in xcode a basic cocoa document based application, with a
delegate:

@implementation delegate
-(void) action: (id) sender;
{
NSDocument * D = [[NSDocumentController sharedDocumentController]
openUntitledDocumentOfType: @"DocumentType" display: YES];
[D setFileName: [NSHomeDirectory() stringByAppendingPathComponent:
@"TEST"]];
[D updateChangeCount: NSChangeDone];
}
@end

The purpose is to create an untitled document and give it
programmatically a new name. The document dataRepresentationOfType
simply returns a void data object.

The problem is that when I save this document, I am asked to give a
file location where to save. If I choose to save as, I see an open
panel exactly at the location ~/TEST!!!

What was my error?
_______________________________________________
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.
_______________________________________________
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.

References: 
 >programmatically setting the file name? (From: Jérôme Laurens <email@hidden>)

  • Prev by Date: Re: Launch crash in strstr... what gives?
  • Next by Date: representationUsingType:NSBMPFileType == nil
  • Previous by thread: programmatically setting the file name?
  • Next by thread: representationUsingType:NSBMPFileType == nil
  • Index(es):
    • Date
    • Thread