Recent

Author Topic: Drag & drop with a display file icon  (Read 5224 times)

Wargan

  • New Member
  • *
  • Posts: 48
    • 'This way' site
Drag & drop with a display file icon
« on: May 06, 2017, 06:16:52 am »
Greetings to all!

I want to drag and drop the file onto the form so that its icon is shown when dragging. As in the picture in the attachment. It's not necessary to display the thumbnail or contents of the file, I just want to see icon and name.

It's possible to implement?

p.s. File should be dragged to a specific location, i.e. to BCPanel (dropFilePanel).
« Last Edit: May 06, 2017, 01:19:25 pm by Wargan »
Lazarus 1.8RC5+ FPC 3.0.4.
Windows 7 x32, RAM 3 Gb.

balazsszekely

  • Guest
Re: Drag & drop with a display file icon
« Reply #1 on: May 06, 2017, 07:01:09 am »
Quote
I want to drag and drop the file onto the form so that its icon is shown when dragging. As in the picture in the attachment. It's not necessary to display the thumbnail or contents of the file, I just want to see icon and name.
It's possible to implement?

Hi Wargan,
For files you already have a default icon implemented(image1). OnDropFiles(Form1) do something like this:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.FormDropFiles(Sender: TObject; const FileNames: array of String);
  2. var
  3.   I: Integer;
  4. begin
  5.   for I := Low(FileNames) to High(FileNames) do
  6.   begin
  7.       //process each file
  8.   end;
  9. end;

For more advanced drawing see the "Example projects" in the "Tool menu"(Image2)

Wargan

  • New Member
  • *
  • Posts: 48
    • 'This way' site
Re: Drag & drop with a display file icon
« Reply #2 on: May 06, 2017, 01:18:46 pm »
Great, GetMem!
Thanks, problem solved.
Lazarus 1.8RC5+ FPC 3.0.4.
Windows 7 x32, RAM 3 Gb.

 

TinyPortal © 2005-2018