...ein Item in einer TListView verschieben?
Autor: Thomas Stutz
// Move item 1 after item 4
// Bewege Item 1 hinter Item 4
function MoveListViewItem(listView: TListView; ItemFrom, ItemTo: Word): Boolean;
var
Source, Target: TListItem;
begin
Result := False;
listview.Items.BeginUpdate;
try
Source := listview.Items[ItemFrom];
Target := listview.Items.Insert(ItemTo);
Target.Assign(Source);
Source.Free;
Result := True;
finally
listview.Items.EndUpdate;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
// Listview1.ViewStyle := vsReport;
if MoveListViewItem(Listview1, 1, 4) then
ShowMessage('Moved!');
end;
printed from
www.swissdelphicenter.ch
developers knowledge base