View Single Post
03-26-14, 02:55 AM   #1
Niketa
A Wyrmkin Dreamwalker
 
Niketa's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2013
Posts: 54
GetItemInfo() Textures

I am trying to put an item icon next to the name on my frame using textures from GetItemInfo(). I've printed out the texture name before creating the buttons and the texture paths print out, however when used to SetTexture(), nothing shows up (the texture works if I change it to something else, such as my warning icon).

Here's where I've selected the texture.

Code:
local name = GetItemInfo(item)
local texture = select(10, GetItemInfo(item))
Here's where I'm trying to use the texture.
Code:
if eCounter > 0 then
	strvars["enchant_title"] = infoFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
	strvars["enchant_title"]:SetPoint("TOPLEFT", title, "BOTTOMLEFT", 0, -20)
	strvars["enchant_title"]:SetText("Missing Enchants:")
	strvars["enchant_title"]:SetJustifyH("LEFT")
	strvars["enchant_title"]:CanWordWrap(true)
	strvars["enchant_title"]:SetWidth(CharacterModelFrame:GetWidth() - 20)

	for key, value in pairs(eList) do
		-- Item icon.
		strvars["eBTN" .. key] = CreateFrame("Button", nil, infoFrame)
		strvars["eBTN" .. key]:SetWidth(16)
		strvars["eBTN" .. key]:SetHeight(16)
		if key == 1 then
			strvars["eBTN" .. key]:SetPoint("TOPLEFT", strvars["enchant_title"], "BOTTOMLEFT", 0, -5)
		else
			strvars["eBTN" .. key]:SetPoint("TOPLEFT", strvars["eBTN" .. (key - 1)], "BOTTOMLEFT", 0, -10)
		end
		strvars["eBTN" .. key]:SetFrameStrata("HIGH")

		strvars["eICO" .. key] = strvars["eBTN" .. key]:CreateTexture(nil, "BACKGROUND")
  		strvars["eICO" .. key]:SetTexture(texture)
  		strvars["eICO" .. key]:SetAllPoints(strvars["eBTN" .. key])

		-- Item name.
		strvars["eStr" .. key] = infoFrame:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
		strvars["eStr" .. key]:SetPoint("TOPLEFT", strvars["eBTN" .. key], "TOPRIGHT", 3, 0)
		strvars["eStr" .. key]:SetText(value)
		strvars["eStr" .. key]:SetJustifyH("LEFT")
		strvars["eStr" .. key]:CanWordWrap(true)
		strvars["eStr" .. key]:SetWidth(CharacterModelFrame:GetWidth() - 39)
	end
end
Here is a picture of what's displayed (or rather what's not displaying) as well as the paths printed out. The indentation to the left of the item names is where the button is. Don't mind the indentation of the gems part, it's still going based off the text from before I added the icon button.

  Reply With Quote