-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditBox.lua
More file actions
37 lines (30 loc) · 1.02 KB
/
EditBox.lua
File metadata and controls
37 lines (30 loc) · 1.02 KB
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
local addon, ns = ...
local editboxBackdrop = {
bgFile = "Interface\\ChatFrame\\ChatFrameBackground",
edgeFile = "Interface\\ChatFrame\\ChatFrameBackground",
tile = true, edgeSize = 1, tileSize = 5,
}
local function onEditFocusGained(self)
self:HighlightText()
end
function ns:CreateEditBox(name, parent, labelText)
local editBox = CreateFrame("EditBox", name, parent)
editBox:SetAutoFocus(false)
editBox:SetFontObject(GameFontHighlightSmall)
editBox:SetHeight(15)
editBox:SetWidth(64)
editBox:SetJustifyH("CENTER")
editBox:EnableMouse(true)
editBox:SetBackdrop(editboxBackdrop)
editBox:SetBackdropColor(0, 0, 0, 0.5)
editBox:SetBackdropBorderColor(0.3, 0.3, 0.30, 0.80)
editBox:SetScript("OnEditFocusGained", onEditFocusGained)
local label = nil
if labelText ~= nil then
label = editBox:CreateFontString(nil, "OVERLAY", "GameFontNormal")
label:SetJustifyH("LEFT")
label:SetHeight(15)
label:SetText(labelText)
end
return editBox, label
end