Drag and Drop
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Drag and Drop
Hi,
I am trying to get drag and drop to work on UBUNTU 14.0.4 LTS 64 - Bit.
So far no luck. Was anyone of you successful?
Best,
Malte
I am trying to get drag and drop to work on UBUNTU 14.0.4 LTS 64 - Bit.
So far no luck. Was anyone of you successful?
Best,
Malte
Re: Drag and Drop
It works, I just tested this code:
########CODE#######
on dragEnter
if "image" is in keys(the dragData) or "files" is in keys(the dragData) then
set the foregroundcolor of the target to "green"
set the dragAction to "copy"
else
set the dragAction to "none"
end if
end dragEnter
on dragLeave
set the foreGroundColor of the target to empty
end dragLeave
on dragDrop
put "gif,jpg,bmp" into immagini
if "files" is in keys(the dragData) then
# è una lista di immagini
repeat for each line theLine in the dragData["files"]
set itemdel to "."
put the last item of theLine into testfile
set itemdel to ","
if lower(testfile) is among the items of immagini then
import paint from file theLine
end if
end repeat
else
#è un'immagine portata da un programma
create image
put the dragData["image"] into last image
end if
set the foreGroundColor of the target to empty
end dragDrop
#####END OF CODE#####
Livecode 6.7.5 and Ubuntu
########CODE#######
on dragEnter
if "image" is in keys(the dragData) or "files" is in keys(the dragData) then
set the foregroundcolor of the target to "green"
set the dragAction to "copy"
else
set the dragAction to "none"
end if
end dragEnter
on dragLeave
set the foreGroundColor of the target to empty
end dragLeave
on dragDrop
put "gif,jpg,bmp" into immagini
if "files" is in keys(the dragData) then
# è una lista di immagini
repeat for each line theLine in the dragData["files"]
set itemdel to "."
put the last item of theLine into testfile
set itemdel to ","
if lower(testfile) is among the items of immagini then
import paint from file theLine
end if
end repeat
else
#è un'immagine portata da un programma
create image
put the dragData["image"] into last image
end if
set the foreGroundColor of the target to empty
end dragDrop
#####END OF CODE#####
Livecode 6.7.5 and Ubuntu
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Drag and Drop
Hi,
using the dragData["files"] on Linux (Xubuntu 1504) I get
in 6.7.8 (as expected): file://<filepath> where <filepath> is the usual full unix filepath .
in 7.1.1: cryptic unicode data (looks like UTF16), but I cannot decode it.
in 8.0.0-dp12: not usable, sometimes gives text, sometimes crashes.
How can I get from dragdata["files"] in LC > 6 an usable result?
All three LC versions above work fine in MacOS 10.11 and Win 10.
using the dragData["files"] on Linux (Xubuntu 1504) I get
in 6.7.8 (as expected): file://<filepath> where <filepath> is the usual full unix filepath .
in 7.1.1: cryptic unicode data (looks like UTF16), but I cannot decode it.
in 8.0.0-dp12: not usable, sometimes gives text, sometimes crashes.
How can I get from dragdata["files"] in LC > 6 an usable result?
All three LC versions above work fine in MacOS 10.11 and Win 10.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 9856
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Drag and Drop
I've been using the dragData["files"] successfully on v6, 7, and 8 within a dragDrop handler. There was a bug with that in early versions of v7, but addressed quite some time ago. In what context is it not working for you?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Drag and Drop
This is in LC 7.1.1/Xubuntu in a simple dragEnter handler (or dragDrop), that works always on Mac/Win,
and also Linux/LC 6.7.8
put line 1 of the dragData["files"]
On Mac/Win I get the usual 'unix' path, in Linux prepended by "file://", should be here "file:///home/hh/Pictures/caledonian.jpg"
what I get is in the attached screenshot (can't even copy the output)
on Xubuntu1504/LC 7.1.1.
and also Linux/LC 6.7.8
put line 1 of the dragData["files"]
On Mac/Win I get the usual 'unix' path, in Linux prepended by "file://", should be here "file:///home/hh/Pictures/caledonian.jpg"
what I get is in the attached screenshot (can't even copy the output)
on Xubuntu1504/LC 7.1.1.
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Drag and Drop
Found a workaround. It is not a 'regular unicoded' filePath in 7.1.1, so we have to replace the second Null-bytes were they are (which is not totally as usual).
The next three lines give a workaround for those who have problems with the possible occuring LC 7.1. dragdata["files"]-bug.
This doesn't change anything for other OSes --and LC versions , they work as well with this code:
Situation: dragDrop a *single* file icon to a stack. (Of multiple files we use the first in the list).
f is now a usual file path as needed for Mac/Win/Linux (incl. Raspi).
Once again, for beginners, used in a dragDrop handler:
The next three lines give a workaround for those who have problems with the possible occuring LC 7.1. dragdata["files"]-bug.
This doesn't change anything for other OSes --and LC versions , they work as well with this code:
Situation: dragDrop a *single* file icon to a stack. (Of multiple files we use the first in the list).
Code: Select all
put line 1 of the dragData["text"] into f
replace numToByte(0) with empty in f
replace "file:" with empty in f
Once again, for beginners, used in a dragDrop handler:
Code: Select all
on dragDrop
put line 1 of the dragData["text"] into f
replace numToByte(0) with empty in f
replace "file:" with empty in f
-- your checks for img or text here --> as MaxV explained above
--
--[1] image file was dropped, replaces an existing image
put url("binfile:"&f) into iData
set text of img iTarget to iData
--
--[2] text file was dropped, replaces text of an existing field
put url("file:"&f) into iData
set text of fld iTarget to iData
--
-- your final work here
end dragDrop
shiftLock happens
-
- VIP Livecode Opensource Backer
- Posts: 9856
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Drag and Drop
A while back I'd seen this on Ubuntu, but haven't been able to reproduce it since v7.1 so I closed my report:
http://quality.livecode.com/show_bug.cgi?id=14834
Searching the bug DB for related issues I found this one, which seems to cover the symptoms you describe and is still open:
http://quality.livecode.com/show_bug.cgi?id=14494
I'm not sure how my situation got resolved; possibly setting a global property like allowDrops or something, I'll have to explore to see if I can reproduce the issue again.
In the meantime, please feel free to submit any additional info you have to the report for bug #14494.
http://quality.livecode.com/show_bug.cgi?id=14834
Searching the bug DB for related issues I found this one, which seems to cover the symptoms you describe and is still open:
http://quality.livecode.com/show_bug.cgi?id=14494
I'm not sure how my situation got resolved; possibly setting a global property like allowDrops or something, I'll have to explore to see if I can reproduce the issue again.
In the meantime, please feel free to submit any additional info you have to the report for bug #14494.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Drag and Drop
This issue is resolved in Livecode 7.1.1 rc4
I think that it's unicode related...
I think that it's unicode related...
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Drag and Drop
Hi Max,
I tested here on Xubuntu 1504 and found the problem with the *stable* version LC 7.1.1.
It's an uncompletely unicoded path, that's why unidecode doesn't work.
Hermann
Have a good end of the year!
I tested here on Xubuntu 1504 and found the problem with the *stable* version LC 7.1.1.
It's an uncompletely unicoded path, that's why unidecode doesn't work.
Hermann
Have a good end of the year!
shiftLock happens
Re: Drag and Drop
Linux mint 17.2 and livecode 7.1.1rc4 works well...
I'm perplexed
I'm perplexed
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
-
- VIP Livecode Opensource Backer
- Posts: 9856
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Drag and Drop
32-bit or 64-bit?[-hh] wrote:I tested here on Xubuntu 1504 and found the problem with the *stable* version LC 7.1.1.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: Drag and Drop
Good question.
I use LC 7.1.1 32 bit/x86. Tested again on Xubuntu 15.10 (wily) and see the 'defect'.
I use LC 7.1.1 32 bit/x86. Tested again on Xubuntu 15.10 (wily) and see the 'defect'.
shiftLock happens
Re: Drag and Drop
64 bit version is ok for me
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w