[SOLVED] Drag.Paste("text/uri-list") problem.
Posted
#1
(In Topic #1113)
Trainee
Normally, "Debug a" Should be Processed, but some files Will be Processed with "Debug B".
Public Sub ListBox1_Drop()
The actual file name is 'ABC+123.txt' but the variable F is 'ABC 123.txt'.
Apparently, the '+' character is incorrectly converted into a space.
I want to solve the error conversion, but I don't know what to do.
Thank you all.
Posted
Guru

f = Replace(FromURL(f), "file://", "")
If Exist(f) ……
Posted
Trainee
I don't think it is necessary to "Replace()" because the "file://" has already been removed for the variable F in this program.
And I think there is a problem with the "FromURL()" function.
ex) ? FromURL("A+B")
A B
This function is also converted to "+" symbols to space.
Thanks
Posted
Guru

<IMG src="https://www.cogier.com/gambas/ListBoxDrop.png">
</IMG>
Posted
Guru

my solution was to convert the + to an unusual ascii char then convert it back after FromURL…
Posted
Guru

I'll call it FromURI()
Code (gambas)
- Return sURI
Posted
Guru

Code (gambas)
Posted
Guru

So it seems gtk3 drag data looks something like this
FileName1\r\n
FileName2\r\n
but QT looks something more like this..
FileName1\r\n
-00:00:00\r
FileName2\r\n
-00:00:00\r
so here a URI-list decoder that should work with gtk and qt
Code (gambas)
Posted
Regular

Posted
Guru

Posted
Guru

FromURL() does not decode '+' into a space before having encountered the '?'... (b610a6a2) · Commits · Gambas / gambas · GitLab
Well for the FromURL() function.
I'm not at home to test if it also fixed it for Drag.Paste() but if it uses FromURL() then it will be.
Thank you Benoit 8-)
Posted
Guru

I've suggested a fix to Benoit.
I'm sure it will soon be squashed <EMOJI seq="1f60e" tseq="1f60e">😎</EMOJI>
Posted
Regular

Currently, by using "FromUrl()" function:BruceSteers said
…but if it uses FromURL() then…
Code (gambas)
Europaeus sum !
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Posted
Trainee
I compiled the latest Gambas.
And the problem was solved.
Thank you everyone.
Posted
Guru

after fixing the interpreters FromURL() function Benoit then modified the Drag.Paste() uri-list function to use FromURL() and removed the code from gb.gui.base it used to use that was essentially the same as FromURL() anyway.
So both FromURL() and Drag.Paste() are fixed and gb.gui.base got a little lighter <EMOJI seq="1f60e" tseq="1f60e">😎</EMOJI>
Just a note….
When something like this happens and a bug gets fixed remember it's only fixed in the latest gambas master.
If you need backward compatibility (if your software is public for others to use they may not have latest gambas) you'll still need a workaround like some of the ideas we provided.
If you know your software is only going to be used on machines that will have latest gambas then it's fine and that bug will never occur again.
1 guest and 0 members have just viewed this.


