Code:
function MyMod_OnLoad()
for i=1,MaxLines-1 do
blanki = CreateFrame("Button","MyModEntry"..i+1, UIParent,"MyModEntryTemplate")
getglobal("MyModEntry"..i+1):SetPoint("TOPLEFT","MyModEntry"..i,"BOTTOMLEFT")
getglobal("MyModEntry"..i+1):RegisterAllEvents()
getglobal("MyModEntry1"):SetScript("OnClick",function ()
ChatFrame1:AddMessage("Click Recieved");
end)
end
for i=1,50 do
MyModData[i] = "Test "..math.random(100)
end
MyModScrollBar:Show()
end
I'm not very far in the development of the portion of the addon using this, and I realize getglobal is deprecated but it is what the code sample uses so I figured I'd achieve my goals first before updating the code/element names.
The bold line is my problem--it works as is but if I change it to match the italic line above. So SetScript for a dynamically identified (and dynamically created) element, it errors out.. or more importantly.. stops execution. Is there a way I can say
Code:
getglobal("MyModEntry"..i+1):RegisterAllEvents()
getglobal("MyModEntry"..i+1):SetScript("OnClick",function ()
ChatFrame1:AddMessage("Click Recieved");
end)
Thank you for any help.
No comments:
Post a Comment