View Single Post
10-22-13, 07:51 PM   #3
kurapica.igas
A Chromatic Dragonspawn
Join Date: Aug 2011
Posts: 152
Lua Code:
  1. local infoSet = {
  2.     infoFrame = {info1, info2, info3, info4},
  3.     imageAnchor = {Image1, Image2, Image3, Image4},
  4.     button = {button1, button2, button3, button4},
  5. }
  6.  
  7. local function CreateInfoFrame()
  8.     local i = #(infoSet.infoFrame) + 1
  9.  
  10.     local infoBox
  11.     infoBox = CreateFrame("Frame")
  12.     infoBox:SetSize(420, 90)
  13.     infoBox:SetPoint("BOTTOMLEFT", infoSet.imageAnchor[i], "BOTTOMRIGHT", -12, 3.5)
  14.     infoBox:SetFrameStrata("TOOLTIP")
  15.     infoBox:SetFrameLevel("16")
  16.     infoBox:SetBackdrop(Artwork_Import.infoBox)
  17.  
  18.     infoSet.infoFrame[i] = infoBox
  19.    
  20.     local button
  21.     button = CreateFrame("Button")
  22.     button:SetSize(80, 24)
  23.     button:SetPoint("BOTTOMRIGHT", infoBox, "BOTTOMRIGHT", -12, 10)
  24.     button:SetFrameStrata("TOOLTIP")
  25.     button:SetFrameLevel("17")
  26.     button:SetBackdrop(Artwork_Import.enableButton)
  27.     button:SetBackdropBorderColor(0.2,0.2,0.2)
  28.  
  29.     infoSet.button[i] = button
  30.  
  31.     return infoBox
  32. end
  33.  
  34. -- 1
  35. local infoBox = CreateInfoFrame()
  36.  
  37. do
  38.     infoBox.text = infoBox:CreateFontString(nil, "OVERLAY")
  39.     infoBox.text:SetPoint("CENTER", infoBox, "CENTER")
  40.     infoBox.text:SetFont(FONT, 10)
  41.     infoBox.text:SetText(TEXT.BottomChat)
  42.     infoBox.text:SetTextColor(classcolor.r, classcolor.g, classcolor.b)
  43. end
  44.  
  45. -- 2
  46. local infoBox = CreateInfoFrame()
  47.  
  48. do
  49.     infoBox.text = infoBox:CreateFontString(nil, "OVERLAY")
  50.     -- more
  51. 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
  Reply With Quote