Author: Tomas Rutkauskas
I want to move items up and down a TListBox controlled by the up and down arrows.
Has anyone got the code to do this?
Answer:
Here's something to move a selected item down:
1 2 procedure TF_MainForm.b_fileDownClick(Sender: TObject);
3 var4 i: integer;
5 begin6 i := LB_Files.itemindex;
7 if (i = -1) or (i = LB_Files.items.count - 1) then8 Exit;
9 LB_Files.Items.Move(LB_Files.itemindex, LB_Files.itemindex + 1);
10 LB_Files.itemindex := i + 1;
11 end;