Hey guys.
The issue I'm having is that when I make this edit box it specifically has focus issues that make it impossible for me to jump, or use the enter key to open up the edit box for the default chat frame. Furthermore, even though the edit box seems to have focus issues, I can't actually type stuff into it.
Here are the relevant bits of code:
Code:
function PowerBars:CreateEdit(parent, name, text, width, height, multi, numeric, password, maxletters, insets)
local width = width or 50;
local height = height or 20;
if width == "def" then
width = 50;
end
if height == "def" then
height = 20;
end
local multi = multi or 0;
local numeric = numeric or 0;
local password = password or 0;
local maxletters = maxletters or 0;
local text = text or nil;
local insets = insets or {0,0,0,0};
newEditBox = CreateFrame("EDITBOX", name, parent, "INPUTBOXTEMPLATE");
newEditBox:SetText(text);
newEditBox:SetSize(width, height);
if multi == true or multi == "isMulti" then
newEditBox:SetMultiLine(true);
end
if numeric == true or numeric == "isNum" then
newEditBox:SetNumeric(true);
end
if password == true or password == "isPass" then
newEditBox:SetPassword(true);
end
if maxletters > 0 then
newEditBox:SetMaxLetters(maxletters);
end
newEditBox:SetTextInsets(insets[1],insets[2],insets[3],insets[4]);
return newEditBox;
end
PowerBars.Edits.BaseOpacity = PowerBars:CreateEdit(PowerBars.panel, "PBEdits_BaseOpacity", PowerBarsDB.PowSet.BaseFrameAlpha*100, "def", "def", "notMulti", "isNum");
BaseOpacity.Edit = PowerBars.Edits.BaseOpacity;
BaseOpacity.Edit:SetPoint("TOP", BaseOpacity.Slider, "CENTER");
BaseOpacity.Edit:ClearFocus();
BaseOpacity.Edit:SetScript("OnEscapePressed",
function(self)
self:ClearFocus();
end);
BaseOpacity.Edit:SetScript("OnUpdate",
function(self)
_G[BaseOpacity.Slider:GetName() .. 'Text']:SetText("'0 power' Opacity: "..(math.floor(self:GetText()*100)));
self:SetText((math.floor(self:GetText()*100)));
PowerBarsDB.PowSet.BaseFrameAlpha = self:GetText();
Res.Texture:SetAlpha(PowerBarsDB.PowSet.BaseFrameAlpha);
end);
BaseOpacity is a local table created earlier.
Any help would be appreciated.
Edit: Putting newEditBox:SetAutoFocus(false) in the creation function fixes the focus issue but doesn't allow me to type in the box. Also, it's sort of dumb that AutoFocus is set true by default...