>From what I could see, looking at the code yesterday.  Only the
TTreeview has drag-n-drop enabled.  I managed to get TListbox working
as well, but not the way it works in Delphi.  Still busy playing with
it though.

Regards,
  - Graeme -



On 3/9/06, Matthijs Willemstein <[EMAIL PROTECTED]> wrote:
> On Thu, 2006-03-09 at 15:05 +0100, Lepidosteus wrote:
> > Thanks, really looking forward to it !
> All right. The following code works. Place a TTreeView on a Form and add
> items to it. Use the following code:
>
> var
>   SleepNode: TTreeNode; // To store the dragged node.
>
> procedure TForm1.TreeView1DragOver(Sender, Source: TObject; X, Y:
> Integer;
>   State: TDragState; var Accept: Boolean);
> var
>   HT : THitTests;
> begin
>   Accept := False;
>   HT := TreeView1.GetHitTestInfoAt(X, Y);
>   if (htOnItem in HT) or (htOnButton in HT) or (htOnindent in HT) then
> begin
>     Accept := True;
>   end;
> end;
>
> procedure TForm1.TreeView1StartDrag(Sender: TObject; DragObject:
> TDragObject);
> begin
>   SleepNode := TreeView1.Selected;
> end;
>
> procedure TForm1.TreeView1DragDrop(Sender, Source: TObject; X, Y:
> Integer);
> var
>   OntvangNode : TTreeNode;
>   HT : THitTests;
> begin
>   OntvangNode := nil;
>   HT := TreeView1.GetHitTestInfoAt(X, Y);
>   if (htOnItem in HT) or (htOnButton in HT) or (htOnindent in HT) then
> begin
>     OntvangNode := TreeView1.GetNodeAT(X, Y);
>   end;
>   if (OntvangNode <> nil) and (SleepNode <> nil) then begin
>     SleepNode.MoveTo(OntvangNode, naAddChild);
>   end;
>   SleepNode := nil;
> end;
>
> I had this code in an old Delphi project, pasted it in my Lazarus
> project and it worked out of the box :)
>
> Matthijs
> --
> Matthijs Willemstein <[EMAIL PROTECTED]>
>
> _________________________________________________________________
>      To unsubscribe: mail [EMAIL PROTECTED] with
>                 "unsubscribe" as the Subject
>    archives at http://www.lazarus.freepascal.org/mailarchives
>

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to