Thread: Text label
View Single Post
02-14-17, 03:10 PM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,879
Lua Code:
  1. local function createEditBox( nomEditBox, frameParent, posX, posY, text, longueur)
  2.         local nomEditBox = CreateFrame("EditBox", tostring( nomEditBox ), frameParent, "InputBoxTemplate")
  3.         nomEditBox:SetPoint("CENTER", posX + decallageX, posY + decallageY)
  4.         nomEditBox:SetText(text)
  5.         nomEditBox:SetFrameStrata("HIGH")
  6.         nomEditBox:SetSize(longueur, 1)
  7.         nomEditBox:SetScript("OnEscapePressed", function(self)
  8.             local frame = frameParent:GetParent()
  9.             local parent = frame:GetParent()
  10.             parent:Hide()
  11.         end)
  12.         nomEditBox.Label = nomEditBox:CreateFontString(nil , "BORDER", "GameFontNormal")
  13.         nomEditBox.Label:SetJustifyH("RIGHT")
  14.         nomEditBox.Label:SetPoint("TOPRIGHT", nomEditBox, "TOPLEFT", -5)
  15.         return nomEditBox
  16.     end
  17.      
  18.     editBox1 = createEditBox(self, customWeightPanel, 50, 90, "Box1", 250)
  19.     editBox1.Label:SetText("Editbox 1")
  20.     editBox2 = createEditBox(self, customWeightPanel, 50, 60, "Box2", 250)
  21.     editBox2.Label:SetText("Editbox 1")
  22.     editBox3 = createEditBox(self, customWeightPanel, 50, 30, "Box3", 250)
  23.     editBox3.Label:SetText("Editbox 1")

You could set the text in the function rather than after creating the editbox.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote