landrix / The-Drag-and-Drop-Component-Suite-for-Delphi

MIT License
161 stars 57 forks source link

Update DropTarget.pas #30

Closed philipp-H closed 5 years ago

philipp-H commented 5 years ago

Multitarget won't work when changing Target property on TDropComboTarget. When changing the target the previous target gets unregistered.

Example: DFM:

object Form4: TForm4
  Left = 0
  Top = 0
  Caption = 'Form4'
  ClientHeight = 300
  ClientWidth = 635
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Edit1: TEdit
    Left = 40
    Top = 24
    Width = 121
    Height = 21
    TabOrder = 0
    Text = 'Edit1'
  end
  object Edit2: TEdit
    Left = 40
    Top = 64
    Width = 121
    Height = 21
    TabOrder = 1
    Text = 'Edit2'
  end
  object Edit3: TEdit
    Left = 40
    Top = 104
    Width = 121
    Height = 21
    TabOrder = 2
    Text = 'Edit3'
  end
  object DropComboTarget1: TDropComboTarget
    DragTypes = [dtCopy, dtLink]
    WinTarget = 0
    Left = 248
    Top = 48
  end
end

Pas:

unit Unit4;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, DragDrop, DropTarget, DropComboTarget, StdCtrls;

type
  TForm4 = class(TForm)
    DropComboTarget1: TDropComboTarget;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    procedure FormCreate(Sender: TObject);
  private
    { Private-Deklarationen }
  public
    { Public-Deklarationen }
  end;

var
  Form4: TForm4;

implementation

{$R *.dfm}

procedure TForm4.FormCreate(Sender: TObject);
begin
   DropComboTarget1.MultiTarget := true;
   DropComboTarget1.Target := Edit1;
   DropComboTarget1.Target := Edit2;
   DropComboTarget1.Target := Edit3;
end;

end.
landrix commented 5 years ago

Thanks