Recent

Author Topic: Fork of Anders Melander's "Drag and Drop Suite 5.2" (WIN only!)  (Read 8228 times)

six1

  • Jr. Member
  • **
  • Posts: 73
Fork of Anders Melander's "Drag and Drop Suite 5.2" (WIN only!)
« on: October 30, 2017, 12:57:09 pm »
Hi,
for a project of mine, i needed Drag&Drop inside my Software and also to and from external Windows (i.e. Explorer, Outlook...)

I didn't get that §$"%!& working on my own, but i found Melanders GREAT! Drag&Drop Suite.

Porting the Lib did the trick for me... there are 20 Components for doing the Drag&Drop in Melanders lib.
I got in contact with him and he allowed to publish the Lazarus fork.

Download the zip and extract it to your own components directory.
Open "DragDropLazarus.lpk" in subfolder "Source". Compile and Install it.
A new Section "DragDrop" will apear in Comonent List with 20 new Componnents.

The "DropContextMenue" Component will not work (untestet..), because there is no onOwnerDraw Event for TMenuItem in Lazarus.... (can't fix it, maybe one of you can..)

Tested DropSource and DropTarget, TVirtualFileStreamData, TFileDataFormat and it's working great!


Download Drag&Drop Suite Fork for Lazarus 
Edit:
Package is now part of Lazarus OPM (OnlinePackageManager). Download and install it with OPM or only download Package with above Link.
DragDrop Suite was fixed for 64Bit Version of Lazarus by GetMem and tested by many others!  Thanks...

Have fun, Michael

see also: http://forum.lazarus.freepascal.org/index.php/topic,38362.0.html
« Last Edit: February 16, 2019, 10:58:18 am by six1 »

GetMem

  • Hero Member
  • *****
  • Posts: 3459
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #1 on: October 31, 2017, 07:52:16 am »
Hi six1,

Thanks for converting the component to Lazarus. If you agree, I would like to add it to OPM(http://wiki.freepascal.org/Online_Package_Manager), but first we need to do a few modifications:
1. Fill in the missing info from package description. I did this step for you, please take a look at the attached screenshot. Is the information correct?
2. You should provide a few working examples. I did convert a 2-3 project from the Demos folder, but they are not working(maybe I'm doing something wrong)

regards,
GetMem

six1

  • Jr. Member
  • **
  • Posts: 73
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #2 on: October 31, 2017, 08:41:10 am »
Hi GetMem,
i will do the updates and correct the Delphi Samples for Lazarus.

best, Michael

six1

  • Jr. Member
  • **
  • Posts: 73
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #3 on: November 01, 2017, 08:28:21 am »
Hi,
i've translated a few Samples for Lazarus and also build a "mixed Sample"

Download for new version is  above Link.


Have fun, Michael

GetMem

  • Hero Member
  • *****
  • Posts: 3459
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #4 on: November 01, 2017, 10:35:29 am »
Quote
Hi,
i've translated a few Samples for Lazarus and also build a "mixed Sample"
Download for new version is above Link.
Thank you Michael, I added the component to OPM.
« Last Edit: November 01, 2017, 10:42:11 am by GetMem »

minesadorada

  • Hero Member
  • *****
  • Posts: 579
  • Retired
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #5 on: November 01, 2017, 02:19:58 pm »
I added the component to OPM.
FYI It doesn't install in my version of Trunk.
FPCv3.1.1 Laz v1.9 SVN Rev. 56132M  Windows 10 64-bit
Message: "Cannot compile package"
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

six1

  • Jr. Member
  • **
  • Posts: 73
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #6 on: November 01, 2017, 02:27:08 pm »
Hi,
sorry, can't reproduce this, because i'm on 1.6.4 32Bit...

best, Michael

GetMem

  • Hero Member
  • *****
  • Posts: 3459
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #7 on: November 01, 2017, 02:59:38 pm »
@minesadorada
As always, thanks for reporting it.  :)

@six1
At some point the declaration of the function Stat(see unit dragdropformats), belonging to TStreamAdapter class, has changed from:
Code: Pascal  [Select]
  1. function Stat(out statstg: TStatStg;  grfStatFlag: Longint): HResult; override; stdcall;
to
Code: Pascal  [Select]
  1.  function Stat(out statstg: TStatStg; grfStatFlag: DWORD): HResult; virtual; stdcall;
You should find out the breaking revision then ifdef the code. I assume the changes were done in FPC 3.1.1(but this has to be checked).  So you need something like this:
Code: Pascal  [Select]
  1.     {$IF (FPC_FULLVERSION >= 30101)}
  2.     function Stat(out statstg: TStatStg; grfStatFlag: DWORD): HResult; override; stdcall;
  3.     {$ELSE}
  4.     function Stat(out statstg: TStatStg; grfStatFlag: Longint): HResult; override; stdcall;
  5.     {$ENDIF}
  6.  
and the same done in the implementation. Unfortunately trunk development sometimes break stable versions. OPM usually targets stable versions, so you don't have to correct this error but it would be nice.

six1

  • Jr. Member
  • **
  • Posts: 73
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #8 on: November 01, 2017, 03:14:27 pm »
Hi,
ok, updated Source with your sample GetMem... (above Download link is updated!)
Hope it works for newer Versions of FPC, as i can not test it at the moment.


best, Michael

JD

  • Hero Member
  • *****
  • Posts: 1755
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #9 on: November 01, 2017, 08:48:16 pm »
Hi,
ok, updated Source with your sample GetMem... (above Download link is updated!)
Hope it works for newer Versions of FPC, as i can not test it at the moment.


best, Michael

It works for me on Lazarus 1.8RC5 fpc 3.0.4 even before your latest modifications.

JD
Windows (10, 7) - Lazarus 2.0RC3/FPC 3.2, NewPascal, Delphi

Indy 10.6 series; mORMot; Zeos 7.2.1; SQLite, Firebird, PostgreSQL & MariaDB; VirtualTreeView 5.5.3 R1

GetMem

  • Hero Member
  • *****
  • Posts: 3459
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #10 on: November 01, 2017, 10:04:28 pm »
Quote
@JD
It works for me on Lazarus 1.8RC5 fpc 3.0.4 even before your latest modifications.
The bug mentioned by @minesadorada only occurs with FPC 3.1.1 or FPC trunk.

Quote
@six1
ok, updated Source with your sample GetMem... (above Download link is updated!)
Hope it works for newer Versions of FPC, as i can not test it at the moment.
You forget to ifdef the implementation part of the function Stat. I also modified the "Mixed demo" example.  FindFirstUTF8 was moved to lazfileutils in the latest version of Lazarus, so I had to add lazfileutils to the uses clauses. With that said DragDrop now works with: Laz: 1.6, 1.8, Trunk;  FPC: 3.0.0, 3.0.2, 3.0.4, Trunk. (https://packages.lazarus-ide.org/DragDrop.zip)
I tested each demo again, it works flawlessly on XP, Vista, Win7. On win10 however most off the demos are still not working. By not working I mean I start to drag a file from windows explorer to the designated area, but the cursor does not change, when I drop the file nothing happens. It could be some settings on my system, I did not have enough time to debug it.

@minesadorada
Can you please test it again. I know you have win10(64 bit). Install DragDrop, then open the first 1-2 demo from the LazDemos folder and see if it works on your system.


six1

  • Jr. Member
  • **
  • Posts: 73
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #11 on: November 02, 2017, 06:37:44 am »
Hi GetMem,
first of all, i updated above Download with your fixed version.
I'm working with Win7 and Win10 both Lazarus 1.6.4 fpc 3.0.2
DragDrop is working on both Machines without any problems.

If starting Drag from File explorer didn't start (no Drag Icon), must be a Problem outside the Lib...


Best, Michael

GetMem

  • Hero Member
  • *****
  • Posts: 3459
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #12 on: November 02, 2017, 07:02:00 am »
Quote
@six1
DragDrop is working on both Machines without any problems.
OK then, I will have to figure it out what is wrong at my side.

minesadorada

  • Hero Member
  • *****
  • Posts: 579
  • Retired
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #13 on: November 02, 2017, 07:09:37 am »
@minesadorada
Can you please test it again. I know you have win10(64 bit). Install DragDrop, then open the first 1-2 demo from the LazDemos folder and see if it works on your system.
Testing environment;
OS: Windows 10 64-bit
FPC 32-bit: v3.1.1
Lazarus 32-bit: v1.9 SVN:56132M

Component Re-installed via OPM.
Compiles OK
Opened project "Mixed Demo"

Win32 target: Compiles and runs OK; Drag and Drop functionality to/from Explorer OK

Win64 Target:
Compilation stalls in unit DragDropContext
Code: Pascal  [Select]
  1. DragDropContext.pas(68,22) Error: No matching implementation for interface method "GetCommandString(QWord;LongWord;PUINT;PChar;LongWord):LongInt; StdCall; found"

Linux compilation fails with "Windows" unit in unit DragDrop

HTH
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

GetMem

  • Hero Member
  • *****
  • Posts: 3459
Re: Fork of Anders Melander's "Drag and Drop Suite 5.2"
« Reply #14 on: November 02, 2017, 07:18:19 am »
@minesadorada
I'm afraid DragDrop component is windows only. I changed supported widgetset to win32/64 in OPM. I will investigate the Win64 target error. Thank you for testing.