[Gambas-user] Drag & drop files

Benoît Minisini gambas at ...1...
Sun Dec 18 19:58:03 CET 2011


Le 28/11/2011 10:17, Maria a écrit :
> Hi!
>
> I was trying drag&drop posibilities in Gambas and I was wondering if you could help me with a problem I found.
>
> I create a button with the DROP property TRUE. Then I write this:
>
> PUBLIC SUB button_Drop()
>
> DIM a AS String
>
>    a = Drag.Paste()
>    a = RTrim(a)
>    EXEC ["gedit", a]
> END
>
>
> This works.  Drag.Paste get the file I droped, but in an horrible html format, with %20 in spaces and other
> characters like ñ áéíóú, etc... AND starting with "file://"
> Gedit works because untherstand this format, butmust commands do not understand this format. AND it finishes with a strange character that I have to cut with RTrim otherwise I would not work.
>
> Now the questions:
>
> How to get a lot of files droped into the button?
> How to get real and good path for all applications can untherstand it?
>

You must specify the paste format: Drag.Paste("text/uri-list")

Then you will get a list of uri separated by newline characters.

Then search the internet to find how to convert a "file://" uri into a 
standard file path.

Regards,

-- 
Benoît Minisini




More information about the User mailing list