hab´s so gelöst, nicht schön aber selten
Delphi-Quellcode:
procedure TForm1.ListView1KeyPress(Sender: TObject; var Key: Char);
var selected: integer;
begin
if (key = '-') and (listview1.selcount > 0) then begin
try
selected := Listview1.itemindex + 1;
listview1.items.Insert(Listview1.itemindex + 2);
Listview1.Items[listview1.itemindex + 2] := listview1.Selected;
Listview1.Items[listview1.itemindex].free;
Listview1.Items[selected].Selected := true;
except
screen.cursor := crdefault; //nur falls mal hängt
end;
end;
if (key = '+') and (listview1.selcount > 0) then begin
try
selected := Listview1.itemindex - 1;
listview1.items.Insert(Listview1.itemindex - 1);
Listview1.Items[listview1.itemindex - 2] := listview1.Selected;
Listview1.Items[listview1.itemindex].free;
Listview1.Items[selected].Selected := true;
except
screen.cursor := crdefault; //nur falls mal hängt
end;
end;
end;