View Single Post
07-04-13, 12:48 PM   #1
infernosnow
A Defias Bandit
Join Date: Jan 2009
Posts: 2
Storing frames into an array?

I need to create 50 different CheckButtons and wanted to do so like this:

Lua Code:
  1. local chkBxArPosX = {180, 250, 330, 410, 500};
  2.     local chkBxArPosY = {-30, -50, -70, -90, -110, -130, -150, -170, -190, -210};
  3.     for i=0,i<10 do
  4.         for k=0,k<5 do
  5.             chkBxAr[(i*5)+k] = CreateFrame("CheckButton", "LLcheckB_n", newRaidWin, "UICheckButtonTemplate")
  6.             LLcheck1aBL:SetPoint("TOPLEFT", newRaidWin, "TOPLEFT", chkBxArPosX[k], chkBxArPosX[i]);
  7.             LLcheck1aBL:SetWidth(22);
  8.             LLcheck1aBL:SetHeight(22);
  9.             LLcheck1aBL:Hide();
  10.         end
  11.     end

where chkBxAr is a global array. I seems to be giving me trouble and I wondered if this is even doable. I'm not familiar enough with methods of troubleshooting code, so it's difficult for me to diagnose why this code doesn't work, but I figured I would ask. I would rather not repeat the same createFrame() code 50 times over for all 50 of my CheckButtons that I need.
  Reply With Quote