Lua Code:
local infoSet = {
infoFrame = {info1, info2, info3, info4},
imageAnchor = {Image1, Image2, Image3, Image4},
button = {button1, button2, button3, button4},
}
local function CreateInfoFrame()
local i = #(infoSet.infoFrame) + 1
local infoBox
infoBox = CreateFrame("Frame")
infoBox:SetSize(420, 90)
infoBox:SetPoint("BOTTOMLEFT", infoSet.imageAnchor[i], "BOTTOMRIGHT", -12, 3.5)
infoBox:SetFrameStrata("TOOLTIP")
infoBox:SetFrameLevel("16")
infoBox:SetBackdrop(Artwork_Import.infoBox)
infoSet.infoFrame[i] = infoBox
local button
button = CreateFrame("Button")
button:SetSize(80, 24)
button:SetPoint("BOTTOMRIGHT", infoBox, "BOTTOMRIGHT", -12, 10)
button:SetFrameStrata("TOOLTIP")
button:SetFrameLevel("17")
button:SetBackdrop(Artwork_Import.enableButton)
button:SetBackdropBorderColor(0.2,0.2,0.2)
infoSet.button[i] = button
return infoBox
end
-- 1
local infoBox = CreateInfoFrame()
do
infoBox.text = infoBox:CreateFontString(nil, "OVERLAY")
infoBox.text:SetPoint("CENTER", infoBox, "CENTER")
infoBox.text:SetFont(FONT, 10)
infoBox.text:SetText(TEXT.BottomChat)
infoBox.text:SetTextColor(classcolor.r, classcolor.g, classcolor.b)
end
-- 2
local infoBox = CreateInfoFrame()
do
infoBox.text = infoBox:CreateFontString(nil, "OVERLAY")
-- more
end
If you want create a things like template, you could create a factory function first, use it to create those infoboxs, don't know why you want using OnShow, just create those fontstring directly after you create each infobox should works ok