-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathitem.lua
More file actions
29 lines (26 loc) · 1.2 KB
/
Copy pathitem.lua
File metadata and controls
29 lines (26 loc) · 1.2 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
-- set language display
local _, addon = ...
local L = addon.L
-- Create an input box for the user to enter the item ID
local GetItemLinkBox = CreateFrame("EditBox", "GetItemLinkBox", GetInfoFrame, "InputBoxTemplate");
GetItemLinkBox:SetPoint("TOPLEFT", GetInfoFrame, "TOPLEFT", 15, -60);
GetItemLinkBox:SetSize(100, 20);
GetItemLinkBox:SetAutoFocus(false);
-- Define input box name
local GetItemLinkLabel = GetItemLinkBox:CreateFontString(nil, "OVERLAY", "GameFontNormal");
GetItemLinkLabel:SetPoint("BOTTOM", GetItemLinkBox, "TOP", 0, 5);
GetItemLinkLabel:SetText(L['item_label_text']);
-- When the user presses the Enter key, show the item link
GetItemLinkBox:SetScript("OnEnterPressed", function(self)
local itemID = tonumber(self:GetText())
if itemID ~= nil then
local itemLink = select(2, C_Item.GetItemInfo(itemID))
if itemLink ~= nil and itemLink ~= '' then
DEFAULT_CHAT_FRAME:AddMessage(L['search_result_done'] .. itemLink)
else
DEFAULT_CHAT_FRAME:AddMessage(L['search_result_fail'] .. L['invalid_text'])
end
end
self:SetText(""); -- Clear the text content in the input box
self:ClearFocus(); -- Clear focus
end)