Weil Du in Turbo Delphi Explorer keine Komponenten installieren kannst, musst Du sie zur Laufzeit erstellen:
http://www.delphi-treff.de/tutorials...eit-erstellen/
Heißt für Dein Beispiel die Deklaration
Delphi-Quellcode:
TFormText = class(TForm)
DropSource1: TDropTextSource;
Edit2: TEdit;
StatusBar1: TStatusBar;
Memo2: TMemo;
Edit1: TEdit;
ButtonClipboard: TButton;
Panel1: TPanel;
DropTextTarget1: TDropTextTarget;
DropTextTarget2: TDropTextTarget;
DropDummy1: TDropDummy;
procedure ButtonCloseClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure Edit1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ButtonClipboardClick(Sender: TObject);
procedure Edit2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure DropTextTarget1Drop(Sender: TObject; ShiftState: TShiftState;
Point: TPoint; var Effect: Integer);
procedure DropTextTarget2Drop(Sender: TObject; ShiftState: TShiftState;
Point: TPoint; var Effect: Integer);
procedure DropSourceFeedback(Sender: TObject; Effect: Integer;
var UseDefaultCursors: Boolean);
private
function MouseIsOverEdit2Selection(XPos: integer): boolean;
public
{ Public declarations }
end;
zu
Delphi-Quellcode:
TFormText = class(TForm)
Edit2: TEdit;
StatusBar1: TStatusBar;
Memo2: TMemo;
Edit1: TEdit;
ButtonClipboard: TButton;
Panel1: TPanel;
procedure ButtonCloseClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Edit1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ButtonClipboardClick(Sender: TObject);
procedure Edit2MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure DropTextTarget1Drop(Sender: TObject; ShiftState: TShiftState;
Point: TPoint; var Effect: Integer);
procedure DropTextTarget2Drop(Sender: TObject; ShiftState: TShiftState;
Point: TPoint; var Effect: Integer);
procedure DropSourceFeedback(Sender: TObject; Effect: Integer;
var UseDefaultCursors: Boolean);
private
DropTextTarget1: TDropTextTarget;
DropTextTarget2: TDropTextTarget;
DropDummy1: TDropDummy;
DropSource1: TDropTextSource;
function MouseIsOverEdit2Selection(XPos: integer): boolean;
public
{ Public declarations }
end;
ändern und das FormCreate zu ergänzen:
Delphi-Quellcode:
procedure TFormText.FormCreate(Sender: TObject);
begin
DropTextTarget1 := TDropTextTarget.Create(FormText);
DropTextTarget2 := TDropTextTarget.Create(FormText);
DropDummy1 := TDropDummy.Create(FormText);
DropSource1 := TDropTextSource.Create(FormText);
Screen.cursors[crTextCopy] := LoadCursor(hinstance, 'CUR_DRAG_COPY_TEXT');
Screen.cursors[crTextMove] := LoadCursor(hinstance, 'CUR_DRAG_MOVE_TEXT');
Screen.cursors[crTextNoAccept] := LoadCursor(hinstance, 'CUR_DRAG_NOACCEPT_TEXT');
end;
Dann läuft es.