FMX - Ordering elements from array in Y and X

hi there , i´m designing one website, and I´m using to show clients, one XML file that is loaded by an array, that distributs the buttons alphabetecally in the x axis, but I want to put them in the Y axis like:

ABC
ABC
ABC
ABand so on
AB
AB

I´m using some code I get from a website, and i think I tried all that is in my power, can someone take a look at the code please.

thanks