[Lazarus] Foreach?

Timothy Groves the.tail.kinker at gmail.com
Sat Jun 8 09:32:47 CEST 2013


So I've got this code:

     frmMain.btnMacro1.Caption := MacroList [0].Name;
     frmMain.btnMacro2.Caption := MacroList [1].Name;
     frmMain.btnMacro3.Caption := MacroList [2].Name;
     frmMain.btnMacro4.Caption := MacroList [3].Name;
     frmMain.btnMacro5.Caption := MacroList [4].Name;
     frmMain.btnMacro6.Caption := MacroList [5].Name;
     frmMain.btnMacro7.Caption := MacroList [6].Name;
     frmMain.btnMacro8.Caption := MacroList [7].Name;
     frmMain.btnMacro9.Caption := MacroList [8].Name;
     frmMain.btnMacro10.Caption := MacroList [9].Name;

There's gotta be some kind of construction that would let me foreach 
this.  Any suggestions?




More information about the Lazarus mailing list