> I am using TListBox and I want to move an item up in the list.
here's how I do it, via an up and down arrow.
procedure TfrmManyPrint.actUpInListExecute(Sender: TObject);
var
i : integer;
begin
if lbxPrintCharts.ItemIndex > 0 then
begin
i := lbxPrintCharts.ItemIndex;
lbxPrintCharts.Items.Move(i, i - 1);
lbxPrintCharts.SetFocus;
lbxPrintCharts.ItemIndex := i-1;
end;
end;
procedure TfrmManyPrint.actDownInListExecute(Sender: TObject);
var
i : integer;
begin
if lbxPrintCharts.ItemIndex < lbxPrintCharts.Items.Count-1 then
begin
i := lbxPrintCharts.ItemIndex;
lbxPrintCharts.Items.Move(i, i + 1);
lbxPrintCharts.SetFocus;
lbxPrintCharts.ItemIndex := i+1;
end;
end;