Back to Home

ESO Lua File v100032

libraries/zo_templates/editboxtemplates.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
local DEFAULT_EDIT_BOX_ENABLED_COLOR = ZO_ColorDef:New(1,1,1,1)
local DEFAULT_EDIT_BOX_DISABLED_COLOR = ZO_ColorDef:New(GetInterfaceColor(INTERFACE_COLOR_TYPE_TEXT_COLORS, INTERFACE_TEXT_COLOR_DISABLED))
function ZO_DefaultEdit_SetEnabled(editBox, enabled)
    if(enabled) then
        editBox:SetHandler("OnMouseDown", function() editBox:TakeFocus() end)
        editBox:SetColor(DEFAULT_EDIT_BOX_ENABLED_COLOR:UnpackRGBA())
    else
        editBox:LoseFocus()
        editBox:SetColor(DEFAULT_EDIT_BOX_DISABLED_COLOR:UnpackRGBA())
        editBox:SetHandler("OnMouseDown", nil)
    end
end
do
    local function UpdateVisibility(self)
        local label = GetControl(self, "Text")
        if(self.defaultTextEnabled) then
            if(self:GetText() == "" and not self:IsComposingIMEText()) then
                label:SetHidden(false)
            else
                label:SetHidden(true)
            end
        else
            label:SetHidden(true)
        end
    end
    function ZO_EditDefaultText_Initialize(self, defaultText)
        local label = GetControl(self, "Text")
        label:SetText(defaultText)
        self:SetDefaultTextForVirtualKeyboard(defaultText)
        self.defaultTextEnabled = true
        UpdateVisibility(self)
    end
    function ZO_EditDefaultText_Disable(self)
        self.defaultTextEnabled = false
        UpdateVisibility(self)
    end
        UpdateVisibility(self)
    end
        UpdateVisibility(self)
    end
end