Link to home
Start Free TrialLog in
Avatar of milmil
milmil

asked on

About Drag&Drop

How can I make program with Drag&Drop process? For example: I want to make program whish will get filename and path of file which I drag forom Windows Explorer or my desktop?
Can you send me source code?
ASKER CERTIFIED SOLUTION
Avatar of rwilson032697
rwilson032697

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi,
Here's some code that worked for me copying files from a File List Box to a ChekList Box:

procedure TDSBMainForm.CheckListBox1DragDrop(Sender, Source: TObject; X,
  Y: Integer);
 begin
  AddFilesToList;
 end;


procedure TDSBMainForm.FileListBox1EndDrag(Sender, Target: TObject; X,
  Y: Integer);
begin
if Target <> nil then FileListBox1.Update;

end;

procedure TDSBMainForm.AddFilesToList;
var
 i,j:integer;
 OkayToAdd:Boolean;

begin
  For i:= 0 to FileListBox1.Items.Count -1 do
   if FileListBox1.Selected[i] then
   {check to see if the new item is already in the checklist box}
   begin
      OkayToAdd:=False;
      for j:=0 to CheckListBox1.Items.Count -1 do
        if ExpandFileName(FileListBox1.Items[i])=CheckListBox1.Items[j] then OkayToAdd:=true;
      if OkayToAdd<>true then
        CheckListBox1.Items.Add(ExpandFileName(FileListBox1.items[i]));
   end {if}
end;