Thread: Reuse frame
View Single Post
06-20-16, 11:56 AM   #5
maqjav
A Theradrim Guardian
AddOn Author - Click to view addons
Join Date: Feb 2012
Posts: 60
Originally Posted by semlar View Post
should be
Lua Code:
  1. itemFrames[i].texture:SetTexture(itemTexture)

But I can't say what's causing your erratic behavior without the rest of your code.
Sorry, it was a mistake writing on the forum, in my code I actually have it like you say. I guess the critical wow client error might be something with the PTR. I will keep testing it.

About the erratic behaviour I wonder if it's related with showing and hidding the mainFrame.

Whenever I type my NPC ID, I look for it in a table, then I call my method loadItems and right after I call "mainFrame:Show()".

Code:
local itemsIds = LIST[npcId]
loadItems(itemsIds)
mainFrame:Show()
My mainFrame has a closeButton, and only when I click the button the mainFrame is hidden.
If you type another NPC ID while the frame is open, the idea is that it has to refresh, that's why in my mehod loadItems the first thing I do is to Hide every itemFrame (just in case the itemsIds arrays is smaller than the previous one).

Code:
local CloseButton = _G.CreateFrame("Button", "CloseButton", mainFrame, "UIPanelCloseButton")
CloseButton:SetPoint("BOTTOMRIGHT")
CloseButton:SetSize(32, 32)
CloseButton:SetHitRectInsets(8, 8, 8, 8)
The rest of code I don't think it really matters.


Thank you very much for your time.