On Jan 1, 2011, at 21:13, Kurt Sutter wrote:

> Our application supports two types of NSDocuments. One contains data, the 
> other drawings. Hence, we have defined two sibling classes of NSDocument: 
> DataDocument and DrawingDocument.
> 
> When I create a new instance of DataDocument or DrawingDocument, its window 
> is named "Untitled". However, I would like the new data document to be titled 
> "Untitled Data", and the new drawing document to be titled "Untitled 
> Drawing", so the user can easily distinguish the two, e.g. in the windows 
> menu.
> 
> Obviously, I could overwrite windowTitleForDocumentDisplayName in my window 
> controllers to change the name of the window from "Untitled ..." to "Untitled 
> Drawing ..." or "Untitled Data..." as long as the document has not been 
> associated with a file. However, if I then chose "Save...", the save panel 
> still displays "Untitled". To fix that, I probably could modify the default 
> name in the panel by some twiddling in prepareSavePanel, but I guess there 
> will be other places (such as error messages) where the unfortunate 
> "Untitled" still pops up.
> 
> Any advice how to set the name of an untitled document at one central place?

Try overriding NSDocument's 'displayName' method instead. IIRC that will do the 
right thing in the Save As panel.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to