Quantcast
Text label - WoWInterface
Thread Tools Display Modes
02-14-17, 12:58 PM   #1
Marsgames
An Aku'mai Servant
 
Marsgames's Avatar
Join Date: Jul 2016
Posts: 33
Text label

Hey,

This is a really basic question but I don't find how to add some text to a frame.
I have a frame with 3 editBox
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.  
  13.     return nomEditBox
  14. end
  15.  
  16. editBox1 = createEditBox(self, customWeightPanel, 50, 90, "Box1", 250)
  17. editBox2 = createEditBox(self, customWeightPanel, 50, 60, "Box2", 250)
  18. editBox3 = createEditBox(self, customWeightPanel, 50, 30, "Box3", 250)

And I would have a text at the right of the edit box to describe what I want to put inside

Thanks
  Reply With Quote
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,292
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
02-14-17, 03:59 PM   #3
Marsgames
An Aku'mai Servant
 
Marsgames's Avatar
Join Date: Jul 2016
Posts: 33
Thank you mate, it's exactly what I wanted
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Text label

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off