Lua Code:
local function createEditBox( nomEditBox, frameParent, posX, posY, text, longueur)
local nomEditBox = CreateFrame("EditBox", tostring( nomEditBox ), frameParent, "InputBoxTemplate")
nomEditBox:SetPoint("CENTER", posX + decallageX, posY + decallageY)
nomEditBox:SetText(text)
nomEditBox:SetFrameStrata("HIGH")
nomEditBox:SetSize(longueur, 1)
nomEditBox:SetScript("OnEscapePressed", function(self)
local frame = frameParent:GetParent()
local parent = frame:GetParent()
parent:Hide()
end)
nomEditBox.Label = nomEditBox:CreateFontString(nil , "BORDER", "GameFontNormal")
nomEditBox.Label:SetJustifyH("RIGHT")
nomEditBox.Label:SetPoint("TOPRIGHT", nomEditBox, "TOPLEFT", -5)
return nomEditBox
end
editBox1 = createEditBox(self, customWeightPanel, 50, 90, "Box1", 250)
editBox1.Label:SetText("Editbox 1")
editBox2 = createEditBox(self, customWeightPanel, 50, 60, "Box2", 250)
editBox2.Label:SetText("Editbox 1")
editBox3 = createEditBox(self, customWeightPanel, 50, 30, "Box3", 250)
editBox3.Label:SetText("Editbox 1")
You could set the text in the function rather than after creating the editbox.