How to move down selected items in a TListBox (Views: 27)
Problem/Question/Abstract: 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: procedure TF_MainForm.b_fileDownClick(Sender: TObject); var i: integer; begin i := LB_Files.itemindex; if (i = -1) or (i = LB_Files.items.count - 1) then Exit; LB_Files.Items.Move(LB_Files.itemindex, LB_Files.itemindex + 1); LB_Files.itemindex := i + 1; end; |