![]() |
Drag&Drop im TVirtualStringTree
Hi
ich hab nen TVirtualStringTree und möchte daraus über Drag&Drop Nodes in ein andrers Programm ziehen können. In dem TVirtualStringTree sind verschiedene Musiktitel aufgelistet und mein Programm "weiß" wo sich das entsprechende mp3-File befinet. Ich stelle mir das so vor als ob man nen mp3 vom Explorer zB in den WMP zieht, nur eben nicht vom Explorer sondern von meinem Prog... gibt es vllt irgendwo ein tutorial für D&D?? oder kann mir jemand erklären wie ich das machen muss? thx mfg.dominik |
Re: Drag&Drop im TVirtualStringTree
klar gibt es da tutorials. such doch mal. ich hab seinerzeit erst gesucht und gleich gefunden. das tue ich jetzt nicht für dich...
|
Re: Drag&Drop im TVirtualStringTree
Zitat:
werd nochmal schauen, wenn aber jemand ein paar tipps hat bin ich dankbar :wink: |
Re: Drag&Drop im TVirtualStringTree
ich hab
![]()
Delphi-Quellcode:
allerdings gibt er mir bei der Zeile
procedure TForm1.FileListBox1MouseMove(Sender: TObject; Shift:
TShiftState; X, Y: Integer); const Threshold = 5; var SelFileList: TStrings; i: Integer; DataObject: IDataObject; Effect: DWORD; begin with Sender as TFileListBox do begin if (SelCount > 0) and (csLButtonDown in ControlState) and ((Abs(X - FDragStartPos.x) >= Threshold) or (Abs(Y - FDragStartPos.y) >= Threshold)) then begin Perform(WM_LBUTTONUP, 0, MakeLong(X, Y)); SelFileList := TStringList.Create; try SelFileList.Capacity := SelCount; for i := 0 to Items.Count - 1 do if Selected[i] then SelFileList.Add(Items[i]); DataObject := GetFileListDataObject(Directory, SelFileList); finally SelFileList.Free; end; Effect := DROPEFFECT_NONE; DoDragDrop(DataObject, Self, DROPEFFECT_COPY, Effect); end; end; end;
Delphi-Quellcode:
den Fehler beim compilieren aus:
DoDragDrop(DataObject, Self, DROPEFFECT_COPY, Effect);
Zitat:
Zitat:
|
Re: Drag&Drop im TVirtualStringTree
hallo,
du brauchst da ein element, das das Interface IDropSource implementiert. Das Form tut das anscheinend nicht. Du must wahrscheinlihc die Unit ActiveX dazu einbinden, mach dann mal folgendes: WO in deinem Delphi-Quelltext die Form-Klasse deklariert wird:
Delphi-Quellcode:
daraus machst du:
TForm1 = class (TForm)
Delphi-Quellcode:
Wenn du eine Delphi-Version >= Professional hast, reicht ein beherzter Druck auf "Strg+Shift+C" und du hast deine Stubs da.
TForm1 = class (TForm, IDropSource)
Eventuell solltest du statt dem "self" das du übergibst, einmal versuchen, direkt den VirtualStringTree zu übergeben - kann mir gut vorstellen, dass der das schon implementiert. |
Re: Drag&Drop im TVirtualStringTree
hi
danke für deine hilfe... :wink: es hat sich jetzt herrausgestellt das der letzte parameter kein DWORD sein darf sondern ein normaler Integer...obwohl das im beispiel (was ich ja nicht selbst gecoded hab) UND in der OH falsch drinnstand... jetzt hab ich mein D&D :stupid: thx an alle :cheers: |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:24 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz