[Delphi] Drag&Drop w jednym ListBoxie

0

OK, to już pewnie było... Chodzi mi o coś takiego, jak zrobić, żeby obsłużyć procedurę drag&drop w jednym ListBoxie?
(coś takiego jak w Winampie w playliście)

0

procedure TForm1.ListBox1MouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
if ssLeft in Shift then
TListBox(Sender).BeginDrag(FALSE);
end;

procedure TForm1.ListBox1DragDrop(Sender, Source: TObject; X, Y: Integer);
Var
index : integer;
APoint: TPoint;
begin
APoint.X := X;
APoint.Y := Y;
Index := TListBox(Sender).ItemAtPos(apoint, True);
IF Source.ClassType = TListBox Then
IF TListBox(Source).ItemIndex >= 0 Then
begin
TListBox(Sender).Items.Insert(index,TListBox(Source).Items[TListBox(Source).ItemIndex]);
IF Sender = Source Then TListBox(Source).Items.Delete(TListBox(Source).ItemIndex);
End ;
IF Source.ClassType = TCheckBox Then
TListBox(Sender).Items.Insert(index,TCheckBox(Source).caption);
end;

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

1 użytkowników online, w tym zalogowanych: 0, gości: 1