Robert Meek wrote:
>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!
>
>
Hi Robert,
This is from my DJ audio player application:
{move the selected song to it's new place in the play list
or accept a song from one of the players}
procedure TFmMain.LbPlayListDragDrop(Sender, Source: TObject; X,
Y: Integer);
var
OldPos,NewPos: integer;
APoint: TPoint;
Song: TFilename;
begin
APoint.X := X;
APoint.Y := Y;
with LbPlayList do begin
NewPos := ItemAtPos(APoint,True);
if Source = Sender then begin
if NewPos < 0 then NewPos := Items.Count - 1;
OldPos := ItemIndex;
Items.Move(OldPos,NewPos);
end else begin
if NewPos < 0 then NewPos := Items.Count;
Song :=
((Source as TComponent).Owner as TFmChannel).OpenDialog.FileName;
PlayListInsertSong(NewPos,Song);
UpdateStats;
end;
end;
end;
_______________________________________________
Delphi mailing list -> [EMAIL PROTECTED]
http://www.elists.org/mailman/listinfo/delphi