Hi,
I have a TextArea in my window, and in the DropObject event, I have the following code:
if obj.FolderItemAvailable then
Dim DroppedFile As FolderItem = obj.FolderItem
Dim tis As TextInputStream
tis = TextInputstream.Open(DroppedFile)
TextArea1.text = tis.readall
tis.close
End if
When I drop a .txt file onto it - the TextArea displays the file path of the dropped file, as opposed to it’s text content.
Any ideas what I am doing wrong - or how I get a TextArea to display dropped text?
Thank you all in advance.
[quote=117437:@Richard Summers]Hi,
I have a TextArea in my window, and in the DropObject event, I have the following code:
if obj.FolderItemAvailable then
Dim DroppedFile As FolderItem = obj.FolderItem
Dim tis As TextInputStream
tis = TextInputstream.Open(DroppedFile)
TextArea1.text = tis.readall
tis.close
End if
When I drop a .txt file onto it - the TextArea displays the file path of the dropped file, as opposed to it’s text content.
Any ideas what I am doing wrong - or how I get a TextArea to display dropped text?[/quote]
Looks correct. Are you sure your text file would not contain the path ? Have you tried with different txt files ?
The text file contains 3 lines of gibberish, but shows the path when dropped - that’s why I am so confused??
Any text file I drop causes the same thing - the path to be displayed 
Methinks you never set the AcceptFileDrop.
me.AcceptFileDrop("text/txt")
https://dl.dropboxusercontent.com/u/10504478/droptext.xojo_binary_project
Where did you set it?
Your code works fine assuming, as Tim says, you set the AcceptFileDrop.
Try Tim’s project - comment out the AcceptFileDrop line and you’ll see the results you’re getting. Uncomment it, and it works as expected.