• 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
New document with data from Services?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

New document with data from Services?


  • Subject: New document with data from Services?
  • From: David Sinclair <email@hidden>
  • Date: Sat, 3 Aug 2002 17:40:56 -0700

I'm read the documentation, and searched on mamasam.com, but can't find an answer to the following.

I have a NSDocument-based application, and am trying to add a Service to it to open a new document with the selected text. What I can't figure out is how to both call newDocument: to open the document window, and insert the text into the new text view.

I can call newDocument: via the following from the Services handler method, but how do I then get the data into the text view?

[[NSDocumentController sharedDocumentController] newDocument:self];

Or I can create a new instance of the window controller and insert the text, but how do I do the setup stuff that newDocument: does?

I have to believe that there is an easy way to do this that I'm missing. Any pointers would be appreciated!

Also, while I'm at it: it does the right thing when the app is already running, but if the Service action launches the app, it creates a second new document (in addition to the usual one on launch). Is there any way I can just use the default untitled document in this case?

--

David Sinclair - email@hidden
http://www.dejal.com/
_______________________________________________
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.

  • Prev by Date: full screen
  • Next by Date: NSMutableArray access problem
  • Previous by thread: Re: full screen
  • Next by thread: Re: New document with data from Services?
  • Index(es):
    • Date
    • Thread