AllowDropFiles sends data to an object on the Form also / A memo has drag-drop problems
Original Reporter info from Mantis: fedkad
-
Reporter name: Fedon Kadifeli
Original Reporter info from Mantis: fedkad
- Reporter name: Fedon Kadifeli
Description:
If AllowDropFiles property on the main Form of an application is enabled:
(1) When Main Form's onDropFiles event is fired it will give an array of file names being dragged-and-dropped to the application window. However, in Linux, a memo component that resides on the form will also have the text in FileNames array appended to it (if the user drops the mouse pointer on this memo of course).
(2) When you try to do drag-drop within a memo on the form, the form's onDropFiles event is fired with garbage FileNames array.
Steps to reproduce:
(1) Create a new project and a new form.
(2) Add a memo and a label to the form.
(3) Enable the AllowDropFiles property of the form.
(4) Add the following code to the OnDropFiles event of the form:
procedure TForm1.FormDropFiles(Sender: TObject; const FileNames:
array of String);
var
i : Integer;
begin
label1.Caption := '';
for i:=low(FileNames) to high(FileNames) do
label1.Caption := label1.Caption + LineEnding + FileNames[i]
end;
Then run the application and drag-drop some files from Nautilus (file manager) to the application. Label1 should display their names.
Problem 1: If you drop the files to Memo1 instead of an empty area on the form, a string containing the file names will be added to Memo1 contents (which results in unintentional data change in Memo1).
Problem 2: Select some text from Memo1 and try to drag-drop it somewhere within Memo1 (something that you cannot do if the application were run in Windows). The contents will be moved, but some garbage will be displayed in Label1 (see attached screenshot), because the OnDropFiles event of the form is fired unexpectedly.
Additional information:
* No such behavior in Windows.
* Same problem in 1.8.0 (Linux).
Mantis conversion info:
- Mantis ID: 33292
- OS: Ubuntu Linux
- OS Build: 17.10
- Platform: x86_64-linux-gtk2
- Version: 1.9 (SVN)
- Monitored by: » fedkad (Fedon Kadifeli)