Dragged and dropped file paths not plain text?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
japino
Posts: 78
Joined: Sun Oct 14, 2012 10:56 am

Dragged and dropped file paths not plain text?

Post by japino » Tue Feb 09, 2016 1:10 pm

I'm working on OS X and I've created a field in a stack which accepts files being dragged into it. The field then displays the file paths. The code is this:

Code: Select all

on dragEnter
  set acceptDrop to true
end dragEnter

on dragDrop
put the dragData into me
  pass dragDrop 
end dragDrop
However, the field value does not seem to be what I'm expecting. I cannot use a repeat loop to get all the lines of the field and do something which each of the files.

Suppose the line 1 in the field reads:
/Users/JohnDoe/myfile.txt

Then when I use

Code: Select all

answer line 1 of field "Field"


I just get "/", the first character.

I'm on Livecode 7 now, I'm pretty sure this was different before... Is there an easy way to convert the field value back to normal text?

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Dragged and dropped file paths not plain text?

Post by Klaus » Tue Feb 09, 2016 1:19 pm

HI japino,

hm, just tested your code with LC 7.1.2 RC1 on OS X 10.11.3 and it works as exspected!?
Does it work if you add "files" (which is the official syntax)?:
...
put the dragData["files"] into me
...


Best

Klaus

japino
Posts: 78
Joined: Sun Oct 14, 2012 10:56 am

Re: Dragged and dropped file paths not plain text?

Post by japino » Tue Feb 09, 2016 1:50 pm

Thank you (again) Klaus!

When changing the code to...
put the dragData["files"] into me
...everything then works as expected again.

When I now ask for a particular line in the field, I get the complete line again instead of just a character.

Your fast reply is much appreciated!

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Dragged and dropped file paths not plain text?

Post by Klaus » Tue Feb 09, 2016 2:10 pm

My pleasure! :D

Post Reply