From 2078f282426af065666571575ffa4c233c42d947 Mon Sep 17 00:00:00 2001 From: graemeg Date: Mon, 30 Mar 2009 09:25:32 +0000 Subject: * Patch fixing: Quick drag causes list order corruption. --- src/gui/fpg_listbox.pas | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/gui') diff --git a/src/gui/fpg_listbox.pas b/src/gui/fpg_listbox.pas index 8e9af727..56f53d0d 100644 --- a/src/gui/fpg_listbox.pas +++ b/src/gui/fpg_listbox.pas @@ -548,6 +548,7 @@ end; procedure TfpgBaseListBox.HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); var NewFocus: Integer; + i: Integer; begin inherited HandleMouseMove(x, y, btnstate, shiftstate); @@ -561,8 +562,17 @@ begin if NewFocus < 0 then NewFocus := 0; - if FDragToReorder and FMouseDragging and (NewFocus ItemCount-1 then + NewFocus := ItemCount-1; + if FocusItem < NewFocus then + for i := FocusItem to NewFocus-1 do + Exchange(i, i+1) + else if FocusItem > NewFocus then + for i := FocusItem-1 downto NewFocus do + Exchange(i+1, i); + end; FocusItem := NewFocus; end; -- cgit v1.2.3-70-g09d2