Robert,

Don't know if D2005 dragging & dropping is any different to D7, but the code
below allows you to do what you want to do inside a listbox.

Mike


procedure TForm1.ListBox1DragOver(Sender, Source: TObject; X, Y: Integer;
  State: TDragState; var Accept: Boolean);
begin
  Accept := Sender is TListBox;
end;

procedure TForm1.ListBox1DragDrop(Sender, Source: TObject; X, Y: Integer);
var
  intCount: integer;
  ptCord: TPoint;
  strList: string;
begin
  ptCord.x := x;
  ptCord.y := y;
  intCount := 0;
  while intCount <= TListBox(Source).Items.Count-1 do
  begin
    if TListBox(Source).selected[intCount] then
    begin
      with Sender as TListBox do
      begin
        strList := TListBox(Source).Items[intCount];
        TListBox(Source).Items.Delete(intCount);
        Items.Insert(itemAtPos(ptCord, True), strList);
      end;
    end;
    inc(intCount);
  end;
end;




-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Robert Meek
Sent: Sunday, 21 August 2005 12:50 AM
To: [EMAIL PROTECTED]
Subject: Dragging items inside a Listbox D2005

Morning all,
        Does anyone have a code snip I can look at that provides the ability
to change the order of listbox items via dragging them inside the listbox to
their new position?  All I've been able to find on Google are dragging to
separate listboxes.  Thanx in advance!

from: Robert Meek at: [EMAIL PROTECTED] 
dba "Tangentals Design" home of "PoBoy"
freeware Windows apps and utilities
located at: www.TangentalsDesign.com
e-mail to:
[EMAIL PROTECTED]
[EMAIL PROTECTED]
[EMAIL PROTECTED]



_______________________________________________
Delphi mailing list -> [EMAIL PROTECTED]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [EMAIL PROTECTED]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to