PDA

View Full Version : drag and drop - insert file contents...




dale.albiston
Nov 15, 2007, 03:49 PM
If I save a text file, and then drag the files icon to an NSTextField within my program the system will place the path to that file within the NSTextField.

Q: is there a way to get the system to drop the contents of the file into the NSTextField?

asking since what I'm trying to do is write a custom web browser (which so far works fine using webKit) and make it so every time the URL changes it gets written to a temp file. thus bringing the proxy icon up - for the file containing the URL.

what i'd then like to do is be able to drag that icon to a text box and have the contents of the file written into the text box.

my browser will allow the URL tp be wrapped as a bbCode url, img or an HTML anchor or img tag, or just a plain old url.

the goal being to be able to drag the proxy icon to a browser, or text editor and have my browser format the url as a link, then have it inserted.

this could be the long way to do this..but is there a way? either by saving a file and inserting its contents or some other method.

um.. help?

I've managed to get the browser working ok, just i'd like to get this feature added and working if its possible



antibact1
Nov 16, 2007, 01:21 AM
Have you checked this out yet?

http://developer.apple.com/documentation/Cocoa/Conceptual/DragandDrop/index.html