![]() |
VST zeilen verschieben
Liste der Anhänge anzeigen (Anzahl: 2)
Hallo,
ich benutze die Virtual String Tree als Liste und möchte die einzelnen Zeilen per Maus verschieben, sprich selber sortieren. Dazu habe ich einfach die Routinen von VST DragNDrop OLE Demo verwendet. Im Objektinspektor von der VST habe ich folgende Einstellungen: DragMode: dmAutomatic DragType: dtOLE ClipboardFormats: Virtual Tree Data
Delphi-Quellcode:
Und es funktioniert auch.
procedure TForm1.VSTDragOver(Sender: TBaseVirtualTree;
Source: TObject; Shift: TShiftState; State: TDragState; Pt: TPoint; Mode: TDropMode; var Effect: Integer; var Accept: Boolean); begin if Source=VST then Accept := True; end; procedure TForm1.VSTDragDrop(Sender: TBaseVirtualTree; Source: TObject; DataObject: IDataObject; Formats: TFormatArray; Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode); var S: string; Attachmode: TVTNodeAttachMode; Nodes: TNodeArray; I: Integer; //--------------- local function -------------------------------------------- procedure DetermineEffect; // Determine the drop effect to use if the source is a Virtual Treeview. begin // In the case the source is a Virtual Treeview we know 'move' is the default if dragging within // the same tree and copy if dragging to another tree. Set Effect accordingly. if Shift = [] then begin // No modifier key, so use standard action. if Source = Sender then Effect := DROPEFFECT_MOVE else Effect := DROPEFFECT_COPY; end else begin // A modifier key is pressed, hence use this to determine action. if (Shift = [ssAlt]) or (Shift = [ssCtrl, ssAlt]) then Effect := DROPEFFECT_LINK else if Shift = [ssCtrl] then Effect := DROPEFFECT_COPY else Effect := DROPEFFECT_MOVE; end; end; //--------------- end local function ---------------------------------------- begin Nodes := nil; // Translate the drop position into an node attach mode. case Mode of dmAbove: AttachMode := amInsertBefore; // dmOnNode: // AttachMode := amAddChildLast; //<------ hier deaktiviert dmBelow: AttachMode := amInsertAfter; else AttachMode := amNowhere; end; if DataObject = nil then begin // VCL drag'n drop. Handling this requires detailed knowledge about the sender and its data. This is one reason // why it was a bad decision by Borland to implement something own instead using the system's way. // In this demo we have two known sources of VCL dd data: Tree2 and LogListBox. end else begin // OLE drag'n drop. Perform full processing. if Source is TBaseVirtualTree then begin DetermineEffect; end else if Boolean(Effect and DROPEFFECT_COPY) then Effect := DROPEFFECT_COPY else Effect := DROPEFFECT_MOVE; InsertData(Sender as TVirtualStringTree, DataObject, Formats, Effect, AttachMode); end; end; Aber meine eigentliche Frage wäre optischer Natur, und zwar, eigentlich benötige ich nur die Verschiebefunktion auf gleicher Node-Ebene mit der Maus (siehe Node_verschieben.jpg) und nicht die verschiebe Funktionen in die nächste untergeordnete Ebene (siehe Node_kopieren.jpg). Doch wie kann man bei der VST nur das Verschieben in gleicher Ebene mit der Maus zulassen? :gruebel: Lg, jus |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:43 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