local _, ns = ...

local b = CreateFrame("Button", nil, UIParent, "UIPanelButtonTemplate")
b:SetSize(120, 32)
b:SetText("Reload")
b:SetPoint("TOP", UIParent, "TOP", 0, 0)
b:SetScript("OnClick", function() ReloadUI() end)
--b:Hide()

local bg = CreateFrame("Frame",nil,b)
bg:SetSize(600,300)
bg:SetPoint("TOP",b,"BOTTOM",0,-5)

bg.tex = bg:CreateTexture()
bg.tex:SetColorTexture(0/255, 0/255, 0/255 , 0.7)
bg.tex:SetAllPoints(bg)



local eb = CreateFrame("EditBox", nil, bg)
--eb:SetMaxLetters(7)
eb:SetPoint("TOPLEFT",bg,"TOPLEFT",3,-3)
eb:SetPoint("BOTTOMRIGHT",bg,"BOTTOMRIGHT",-3,3)
eb:SetMultiLine(true)
eb:SetAutoFocus(false) -- probar false
eb:SetFontObject("ChatFontSmall")
--eb:SetText("asd\nsdfsfsd\nsdfsf")
eb:HighlightText(0)
eb:SetText('print("________")')
--eb:HookScript("OnKeyUp", function () print(eb:GetHeight()+6) end)
eb:SetScript("OnEscapePressed",function() eb:ClearFocus() loadstring(eb:GetText())() end)

--eb:SetScript("OnEnterPressed",function() loadstring(eb:GetText())() end)

b:Hide()
function ns.showDebug(value)
    if value then
        b:Show()
    else
        b:Hide()
    end
end