Drag-N-Drop - Not drop target

Things you’d like to miss in the future...
Forum rules
When reporting a bug, please include the following information: your XYplorer version (e.g., v27.90.0047), your Windows version (e.g., Win 11), and your screen scaling percentage (e.g., 125%). We recommend adding your Windows version and screen scaling percentage to your profile or signature. This will make debugging much easier for us.
admin
Site Admin
Posts: 64846
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

That HELPED!! :D Took me an hour of head scratching until I saw it: accessing the Data object in the OLEDragOver event will f*** up
the zip extraction magic! I don't think this is documented anywhere. Anyway: problem solved! (And a free license for jacky :D )

JustinF
Posts: 358
Joined: 28 Jun 2005 23:47
Location: Omaha, Nebraska, USA

Post by JustinF »

I'm having some problems with this. I'm using WinRAR and trying to drag a file out of a .zip file into a directory in Tracker. If there is a file selected in the listview part of Tracker, that file gets copied to whatever directory I'm dragging to instead of the file I want to extract from the .zip. If no file is selected, nothing happens.

If I use AlZip to drag files out of, I get the following message box error and no files get copied:

Code: Select all

---------------------------
Error Copying File or Folder
---------------------------
Cannot copy file: Cannot read from the source file or disk.
---------------------------
OK   
---------------------------
I really appreciate you looking into this drag-n-drop stuff...once we get it working, it'll be very nice.
Justin
Windows 7 Professional

admin
Site Admin
Posts: 64846
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

Oh, you are dropping onto the tree view... I was so enthusiastically experimenting with the list view that I forgot to update the tree view code :roll: ... check out the next upload...

JustinF
Posts: 358
Joined: 28 Jun 2005 23:47
Location: Omaha, Nebraska, USA

Post by JustinF »

admin wrote:Oh, you are dropping onto the tree view... I was so enthusiastically experimenting with the list view that I forgot to update the tree view code :roll: ... check out the next upload...
Actually, it doesn't matter if I drop on the treeview or the listview, I get the same behavior. :(
Justin
Windows 7 Professional

admin
Site Admin
Posts: 64846
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

JustinF wrote:
admin wrote:Oh, you are dropping onto the tree view... I was so enthusiastically experimenting with the list view that I forgot to update the tree view code :roll: ... check out the next upload...
Actually, it doesn't matter if I drop on the treeview or the listview, I get the same behavior. :(
Oh.

You tried only WinRar, right?

JustinF
Posts: 358
Joined: 28 Jun 2005 23:47
Location: Omaha, Nebraska, USA

Post by JustinF »

admin wrote:You tried only WinRar, right?
I tried WinRAR and AlZip. AlZip gives me the "Cannot copy file..." error I posted above. I will install WinZip here in just a second and see what happens.
Justin
Windows 7 Professional

JustinF
Posts: 358
Joined: 28 Jun 2005 23:47
Location: Omaha, Nebraska, USA

Post by JustinF »

Ok, WinZip 10 seems to work fine if I drop the files on the listview. If I drop on the treeview I get the following message box:

Code: Select all

---------------------------
Error Moving File or Folder
---------------------------
Cannot move file: Cannot read from the source file or disk.
---------------------------
OK   
---------------------------
Justin
Windows 7 Professional

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

JustinF wrote: WinZip 10 seems to work fine if I drop the files on the listview. If I drop on the treeview I get the following message box:
Cannot move file: Cannot read from the source file or disk.
Same here. But with WinRAR it's quite different.
Dropping on the listview will not do anything is no file is selected, or I'll get an error (Cannot copy [selected_filename]: source & dest are the same.)

On the treeview it will copy the selected file if there's one, or do nothing if no files were selected.

admin
Site Admin
Posts: 64846
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

Hm hm hm... this gets ever more strange. Winzip sends Effect=1 to OLEDragOver, but WinRAR sends Effect=3 and this is bad for a lot of complicated reasons... to put it short: you can't have dropping from WinRAR and autodetection of the default file operation (watch the drag cursor change between copy and move when you drag over different targets...) at the same time. :cry:

Gotta sleep...

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

admin wrote:Hm hm hm... this gets ever more strange. Winzip sends Effect=1 to OLEDragOver, but WinRAR sends Effect=3 and this is bad for a lot of complicated reasons... to put it short: you can't have dropping from WinRAR and autodetection of the default file operation (watch the drag cursor change between copy and move when you drag over different targets...) at the same time. :cry:
There a bit I don't understand, there is no autodetection (copy or move) when dragging from any soft, WinRAR or WinZIP, and it should be that way. I mean default action when coming out of a compressed file should always be copy, doesn't matter if we'll extract on the same drive as the compressed file is... or did I get that part wrong? :? (or did you mean it's either allowing d&d from WinRAR or autodetection for "regular" d&ds ?? -- if so, explorer does it, so there must be a way.... :P)

Also, I think that could be it. Effect=1 means copy right? So I guess WinZIP does that cause it is always a copy. WinRAR probably uses 3 because it can handle "moving" too.
I mean even with WinZIP & explorer you cannot "move" a file using drag&drop. Even if you hold Shift it will still just be a simple extraction (copy).
But, with WinRAR, if you hold Shift then WinRAR will remove the file(s) from the archive when done!! (aka you "moved" them out) ! That might be why they don't act the same.... (and WinRAR is the best!! :D)

admin
Site Admin
Posts: 64846
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

jacky wrote:...or did you mean it's either allowing d&d from WinRAR or autodetection for "regular" d&ds ?? -- if so, explorer does it, so there must be a way.... :P)
Yes, that's what I meant. And yes, there is a way and I found it :D Explorer sets Effect=7, and that's what TV3 now does, too, when starting a drag (AllowedEffects = 7). Now I can autodetect TV3-internal drags, and leave all others untouched. Works great now.
jacky wrote:... But, with WinRAR, if you hold Shift then WinRAR will remove the file(s) from the archive when done!! (aka you "moved" them out) ! That might be why they don't act the same.... (and WinRAR is the best!! :D)
Cool indeed! And works with TV3 now, too :D

JustinF
Posts: 358
Joined: 28 Jun 2005 23:47
Location: Omaha, Nebraska, USA

Post by JustinF »

Cool! Both WinZip and WinRar work. Unfortunately AlZip still gives the same error. :? I'm not completely tied to AlZip, but I like the idea of an (un)compression program that doesn't nag you...anyone know of another one?

Thanks for your hard work on this one, Donald. Next time you're in Omaha lunch is on me. :lol:
Justin
Windows 7 Professional

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

admin wrote:
jacky wrote:... But, with WinRAR, if you hold Shift then WinRAR will remove the file(s) from the archive when done!! (aka you "moved" them out) ! That might be why they don't act the same.... (and WinRAR is the best!! :D)
Cool indeed! And works with TV3 now, too :D
Well done, it's all great! :D
Just one little thing, when doing a drag&drop from WinRAR and holding Shift, could you change the cursor so the little plus sign (for copy) goes away? Could be confusing I think since the file will be removed from the archive....

admin
Site Admin
Posts: 64846
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Post by admin »

jacky wrote:Just one little thing, when doing a drag&drop from WinRAR and holding Shift, could you change the cursor so the little plus sign (for copy) goes away? Could be confusing I think since the file will be removed from the archive....
I'd love to, but it's not possible! (Try it with your test project) I never managed to change the mouse cursor when dragging onto TrackerV3 from another app (even from another TV3 instance). The source window apparently owns the cursor...?

jacky
XYwiki Master
Posts: 3106
Joined: 23 Aug 2005 22:25
Location: France
Contact:

Post by jacky »

admin wrote:
jacky wrote:Just one little thing, when doing a drag&drop from WinRAR and holding Shift, could you change the cursor so the little plus sign (for copy) goes away? Could be confusing I think since the file will be removed from the archive....
I'd love to, but it's not possible! (Try it with your test project) I never managed to change the mouse cursor when dragging onto TrackerV3 from another app (even from another TV3 instance). The source window apparently owns the cursor...?
Damn that wasn't easy to find! Ok so seems that it is owned by the source, but you have to let it know what to do.
To do that, inside the OLEDragOver event you'll need to change the value of Effect. So changing it to vbDropEffectMove will inform the source that it will be a move operation, and the cursor will be update as so.

In my little test project, it works (dragging from TV3, WinRAR, etc) if I add this:

Code: Select all

Private Sub List1_OLEDragOver(Data As DataObject, Effect As Long, Button As Integer, Shift As Integer, X As Single, Y As Single, State As Integer)
 Select Case Shift
    Case 0, 2: 'classic, or wilh Ctrl
        Effect = vbDropEffectCopy
    Case 1: 'Shift
        Effect = vbDropEffectMove
    Case Else: 'Alt, Shift+Ctrl, etc so we cancel this (unsupported)
        Effect = vbDropEffectNone
 End Select
End Sub
I've noticed that When dragging form TV3 for example, this will change the cursor to the "undroppable" one if you holf Alt, Ctrl+Shift or something like that, while for WinRAR it will show the usual one (Copy). But, WinRAR will still not do anything as it was told to.

Post Reply