• 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
Saving an NSTextView, and Nib troubles
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Saving an NSTextView, and Nib troubles


  • Subject: Saving an NSTextView, and Nib troubles
  • From: email@hidden
  • Date: Thu, 31 May 2001 06:33:42 -0700

Hey, I've been trying to do this for a few days, but its not working. I want to add simple "Open / Save / Save As" functionality to my program. I have an NSTextView that i wish to save from and load into. Originally, when my app was a Document Based Cocoa Application, this worked fine by overloading dataRepresentationOfType, and those other skeleton functions. However, I changed it to be a Cocoa Application and now it doesn't work. I tried the example in the Learning Cocoa book - didn't work either. I get a dialog to select a file, but no files are selectable, and the Save menu item is dimmed. Currently, Open and Save menu items point to FirstResponder.openDocument and FirstResponder.saveDocument. I finally looked at how TextEdit did it, but the code was WAY too complicated. I decided to grab TextEdit's Document.m/h files thinking it was a nice OOP-like custom class I could just 'borrow', but it wanted other files. I kept adding other classes until I pretty much had all of TextEdit in my application, and then STILL, it wasn't attached in any way to my application ;-) I looked at cocoadevcentral's and osx.hyperjeff.net's sample code, but i could not find the answer to my solution. :-) Does anyone know what is going wrong, or could anyone explain the philosophy behind the Open/Save model in Cocoa? I'm so used to the traditional Toolbox, where you were always in control of everything, you controled the flow of the application from your eventloop, etc - this whole "Write an application named dataRepresentationOfType and it will magically get called" voodoo is new to me ;-)

Mike


  • Follow-Ups:
    • Re: Saving an NSTextView, and Nib troubles
      • From: Stéphane Sudre <email@hidden>
  • Prev by Date: Re: Problem overriding NSMutableArray?
  • Next by Date: NSDateFormatter and \n
  • Previous by thread: "public header"
  • Next by thread: Re: Saving an NSTextView, and Nib troubles
  • Index(es):
    • Date
    • Thread