I am new to the drag and drop system in Delphi for ListView. I found a simple solution on the web to drag and drop items into a ListView. The problem is that the code only shows the drag of the first column, and I want to show and drag the whole row.
In the following figure, you can see what I get and what I want.

procedure TForm1.ListView1DragDrop(Sender, Source: TObject; X, Y: Integer); var DragItem, DropItem, CurrentItem, NextItem: TListItem; begin if Sender = Source then with TListView(Sender) do begin DropItem := GetItemAt(X, Y); CurrentItem := Selected; while CurrentItem <> nil do begin NextItem := GetNextItem(CurrentItem, SdAll, [IsSelected]); if DropItem = nil then DragItem := Items.Add else DragItem := Items.Insert(DropItem.Index); DragItem.Assign(CurrentItem); CurrentItem.Free; CurrentItem := NextItem; end; end; end; procedure TForm1.ListView1DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); begin Accept := Sender = ListView1; end; self.ListView1.DragMode := dmAutomatic;
source share