Rahul
Rahul

Reputation: 471

File Drag Drop not working on Form in Lazarus

I had encountered a very strange problem in TForm1.FormDropFiles.

I had attached the entire project. I am unable to locate the problem.

After executing the project form1 is shown and a system tray icon is displayed, when a file is dragged and dropped on form1, then the file name is shown. this works. but when the frmDrop form is invoked from system tray - Show Dropping Platform Menu, and a file is dragged and dropped on frmDrop then the garbage is displayed.

Please have a look in the project and guide, what i had missed in it. The project is attached below.

Demoproject

Upvotes: 3

Views: 710

Answers (1)

David Heffernan
David Heffernan

Reputation: 613562

The top of your formdrop unit looks like this:

unit formdrop;

{$mode objfpc}

But it should look like this:

unit formdrop;

{$mode objfpc}{$H+}

In objfpc strings are short strings by default. To use long strings you need to add {$H+}. The LCL is compiled for long strings and so you need to match that. If you don't then there is a mismatch between the strings that you receive in your OnDropFiles event and the strings that the LCL sent you.

Upvotes: 8

Related Questions