DropFilesAllowed example for Delphi
Take the following steps to demonstrate the use of the Drag and Drop features of the main control:
1. |
Add a button to the main form and code its click procedure as follows: |
procedure TForm1.Button1Click(Sender: TObject);
begin
Lead1.DropFilesAllowed := not Lead1.DropFilesAllowed;
if (Lead1.DropFilesAllowed = TRUE) then
Lead1.DropAutoLoad:= TRUE
else
Lead1.DropAutoLoad:= FALSE;
end;
2. |
Code the OnDropFile Event for the main control as follows: |
procedure TForm1.Lead1DropFile(Sender: TObject; fName: String);
var
msg : string;
begin
msg := 'You have dropped the following file on the main control: ' + fName ;
ShowMessage(msg) ;
end;