daily pastebin goal
47%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. VirtualTreeview drag and drop to arrange nodes in a list
  2. uses
  3.   ActiveX;
  4.    
  5. procedure TForm1.vt1DragAllowed(Sender: TBaseVirtualTree; Node: PVirtualNode; Column: TColumnIndex;
  6.   var Allowed: Boolean);
  7. begin
  8.   Allowed := True;
  9. end;
  10.    
  11. procedure TForm1.vt1DragOver(Sender: TBaseVirtualTree; Source: TObject; Shift: TShiftState;
  12.   State: TDragState; Pt: TPoint; Mode: TDropMode; var Effect: Integer; var Accept: Boolean);
  13. begin
  14.   Accept := (Source = Sender);
  15. end;
  16.    
  17. procedure TForm1.vt1DragDrop(Sender: TBaseVirtualTree; Source: TObject; DataObject: IDataObject;
  18.   Formats: TFormatArray; Shift: TShiftState; Pt: TPoint; var Effect: Integer; Mode: TDropMode);
  19. var
  20.   pSource, pTarget: PVirtualNode;
  21.   attMode: TVTNodeAttachMode;
  22. begin
  23.   pSource := TVirtualStringTree(Source).FocusedNode;
  24.   pTarget := Sender.DropTargetNode;
  25.  
  26.   case Mode of
  27.     dmNowhere: attMode := amNoWhere;
  28.     dmAbove: attMode := amInsertBefore;
  29.     dmOnNode, dmBelow: attMode := amInsertAfter;
  30.   end;
  31.  
  32.   Sender.MoveTo(pSource, pTarget, attMode, False);
  33.  
  34. end;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top