Topic: Drag file to Form field
Hello!
Is it possible to drag a file from Windows explorer, directly to a field in a form, which is of type StoreFile?
Regards,
Eyeman
My Visual Database → General → Drag file to Form field
Hello!
Is it possible to drag a file from Windows explorer, directly to a field in a form, which is of type StoreFile?
Regards,
Eyeman
Hi,
For one file.
The file is being written to database but I haven't tested it completely! (Wrong work if Type is LinkFolder. )
1.Create an OnDropFiles event for DBFile.
2.To the OnDropFiles event in the script:
procedure Form1_DBFile1_OnDropFiles (Sender: TObject; ArrayOfFiles: array of string; X, Y: Integer);
begin
Form1.DBFile1.dbFileName := (ArrayOfFiles[0]);
Form1.DBFile1.text := ExtractFileName((ArrayOfFiles[0]));
end;
Hi Sparrow,
Thank you. The solution works perfectly. Just want to know what does (ArrayOfFiles[0]) signify? What modification needs to be done if file type is LinkFile?
Regards,
Eyeman
Hi Eyeman,
No additional modifications for LinkFile. Everything works, except LinkFolder.
Rather, LinkFolder works))) but with its own characteristics. Some inconveniences and additional code modifications.
(ArrayOfFiles[0]) - element "0" from the array of filenames that are passed to the OnDropFiles event. The array can contain N elements and the numbering of the elements starts from "0". "ArrayOfFiles" is just the name of an array for convenience.
Hi Sparrow,
Thanks for making the concept clear to me. I think the ability to drag a file into a document field will be a very useful option, in many of my projects.
Regards,
Eyeman
My Visual Database → General → Drag file to Form field
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi