View Single Post
01-23-24, 05:20 PM   #4
Walkerbo
A Cobalt Mageweaver
 
Walkerbo's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2010
Posts: 237
Hi SDPhantom and AmadiDooke

Yes, I have already tried expanding the edit box and adjusting the insets, all without success.
When I try a test of just the edit box using the following code it works perfectly;

Lua Code:
  1. local TestScaleNumber = 123
  2.  
  3. local function updateTextBoxNumber(scaleNumber)
  4.    if scaleNumber >= 301 then -- if the entered number is too high
  5.       scaleNumber = 300
  6.    elseif scaleNumber <= 49 then -- if the entered number is too low
  7.       scaleNumber = 50
  8.    end
  9.    TestScaleNumber = scaleNumber / 100
  10.    TestScaleBox:SetText(scaleNumber)  
  11. end
  12.  
  13. local TestScaleBox =
  14. CreateFrame("EditBox", "TestScaleBox", UIParent, "ChatConfigBoxTemplate")
  15. TestScaleBox:SetPoint("CENTER")
  16. TestScaleBox:SetFontObject(NumberFontNormalLargeYellow)
  17. TestScaleBox:SetNumeric(true)
  18. TestScaleBox:SetSize(40, 25)
  19. TestScaleBox:SetMaxLetters(3)
  20. TestScaleBox:SetAutoFocus()
  21. TestScaleBox:SetText("")
  22. TestScaleBox:SetJustifyH("CENTER")
  23. TestScaleBox:SetScript(
  24.    "OnEnterPressed",
  25.    function(self)
  26.       scaleNumber = tonumber(TestScaleBox:GetText())
  27.       print(scaleNumber) -- debug --
  28.       self:ClearFocus()
  29.       updateTextBoxNumber(scaleNumber)
  30.    end
  31. )
  32.  
  33. updateTextBoxNumber(TestScaleNumber)

This code uses the same edit box code and the same function code, other than the UIParent.
__________________
"As someone once told me, frames are just special types of tables, and tables are special types of pointers."
Fizzlemizz
  Reply With Quote