Hi all
I have a frame that can be scaled via a text box.
When I reload I need the text box to be filled with the saved scale.
The frame does correctly scale based on the saved scale on reload however I have not been able to fill the text box with the saved scale value on login.
I get no errors and even when I try to hard-set a number in the text box it remains empty.
Here is my table of variables;
Lua Code:
local NewbDevBoxOptionsTable = {
ButtonFrameScale = 1,
ButtonFrameOpacity = 1,
ButtonIsVisable = true
}
My update frame scale;
Lua Code:
local function updateButtonFrameScale(updateScaleNumber)
if updateScaleNumber >= 301 then -- if the entered number is too high
updateScaleNumber = 300
elseif updateScaleNumber <= 49 then -- if the entered number is too low
updateScaleNumber = 50
end
NewbDevBoxOptionsTable.ButtonFrameScale = updateScaleNumber / 100
NewbDevBoxButtonFrame:SetScale(NewbDevBoxOptionsTable.ButtonFrameScale)
NewbDevBoxInterfaceFrame.ScaleTextBox:SetNumber(updateScaleNumber)
end
and setting the frame scale on player login
Lua Code:
if event == "PLAYER_LOGIN" then
NewbDevBoxButtonFrame:SetScale(NewbDevBoxOptionsTable.ButtonFrameScale)
NewbDevBoxInterfaceFrame.ScaleTextBox:SetNumber(NewbDevBoxOptionsTable.ButtonFrameScale * 100)
and here is my textbox setup
Lua Code:
NewbDevBoxInterfaceFrame.ScaleTextBox =
CreateFrame("EditBox", "NewbDevBoxInterfaceFrameScaleTextBox", NewbDevBoxInterfaceFrame, "OptionsBoxTemplate")
NewbDevBoxInterfaceFrame.ScaleTextBox:SetPoint(
"TOPLEFT",
NewbDevBoxInterfaceFrameKeybindsButton,
"BOTTOMLEFT",
0,
NumberList.textBoxYGap
)
NewbDevBoxInterfaceFrame.ScaleTextBox:SetFontObject(TextDimensionList.checkBoxFont)
NewbDevBoxInterfaceFrame.ScaleTextBox:SetNumeric(true)
NewbDevBoxInterfaceFrame.ScaleTextBox:SetSize(NumberList.scaleTextBoxWidth, NumberList.scaleTextBoxHeight)
NewbDevBoxInterfaceFrame.ScaleTextBox:SetMaxLetters(3)
NewbDevBoxInterfaceFrame.ScaleTextBox:SetAutoFocus()
NewbDevBoxInterfaceFrame.ScaleTextBox:SetJustifyH("CENTER")
NewbDevBoxInterfaceFrame.ScaleTextBox:SetScript(
"OnEnterPressed",
function(self)
scaleNumber = tonumber(NewbDevBoxInterfaceFrame.ScaleTextBox:GetText())
self:ClearFocus()
updateButtonFrameScale(scaleNumber)
end
)
I have not been able to work out why this is not working correctly, it is probably staring me in the face yet I cannot see where I have stuffed up.