View Single Post
07-05-13, 02:31 AM   #5
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,323
Originally Posted by Phanx View Post
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
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote