Originally Posted by Phanx
Math may be faulty (I didn't test it at all) but the theory is sound, and a lot more flexible than storing fixed arrays of coordinates.
|
Fixed for you, still untested.
I'm noting the original X spacing was not uniform at (left-to-right) 70px, 80px, 80px, and 90px. The new spacing will remain 80px. The OP called for the creation of 50 buttons in a grid layout. I fixed this so the checkbuttons aren't staggered in X position while iterating down the Y position.
Code:
local frames = {}
for i = 1, 50 do
local f = CreateFrame("Frame", "LLCheckButton" .. i, newRaidWin, "UICheckButtonTemplate")
f:SetPoint("TOPLEFT", newRaidWin, -180 - ((i - 1) % 5) * 80, -30 - floor((i - 1) / 5) * 20)
f:SetSize(22, 22)
f:Hide()
frames[i] = f
end