Hello, I'm the developer of PileSeller and since some months the code remained untouched.
With the release of 7.1, though, after updating the TOC I noticed a very strange behavior from my scrollframes, in particular the items within it.
To make things simple, my addon is an autoseller that manages the drops you get from raids, instances and so on. These drops are saved into an array which is displayed as a list into a scrollframe (
http://i.imgur.com/zPxQCw9.png)
All the items withing the list are interactable, so if you mouse over 'em you get a tooltip of the item, and if you click on 'em you can gather more informations from the item itself. The problem now, it's that the items that are not "rendered" (so they are in the non-visible part of the scrollframe) are interactable, while before 7.1 this was not the case (
http://i.imgur.com/Cccg9kY.png). The code of the creation of these items is below.
Code:
function PileSeller:CreateScroll(parent, name, width, height, noBorder, noBackground)
local f = CreateFrame("ScrollFrame", name, parent, "UIPanelScrollFrameTemplate")
f:SetSize(width, height)
f:SetClampedToScreen(true)
f:EnableMouseWheel(true)
if not noBackground then
local tex = f:CreateTexture(nil, "BACKGROUND")
tex:SetTexture([[Interface\Buttons\WHITE8X8]])
tex:SetVertexColor(.27,.27,.27,1)
tex:SetAllPoints()
end
if not noBorder then
f:SetBackdrop({
edgeFile = [[Interface\Buttons\WHITE8X8]],
edgeSize = 1,
insets = {
left = 1,
right = 1,
top = 1,
bottom = 1
}
})
f:SetBackdropBorderColor(0, 0, 0)
end
f.content = CreateFrame("Frame", name .. "Content")
f.content:SetSize(width, height)
f:SetScrollChild(f.content)
f:SetScript("OnMouseWheel", function(self, delta)
local vertical = f:GetVerticalScroll()
local max = f:GetVerticalScrollRange()
_G[name .. "ScrollBar"]:SetMinMaxValues(0, max)
local move = 13 * -delta
if vertical + move > 0 and vertical + move < max then
f:SetVerticalScroll(vertical + move)
elseif vertical + move > max then
f:SetVerticalScroll(max)
elseif vertical + move < 0 then
f:SetVerticalScroll(0)
end
_G[name .. "ScrollBar"]:SetValue(f:GetVerticalScroll())
end)
return f
end
Fullscreen reader:
http://hastebin.com/barerineli.lua
Code:
--- Function to create a button while filling a list
--- input:
--- parent = scrollframe to fill
--- id = item id (-1 = nil)
--- progress = normally the method it's run in a for loop, used to create space from one button and another
--- height = height of a button
--- [zoneName] = used for creating the ignored zones
--- outbut: none
function PileSeller:CreateScrollButton(parent, id, progress, width, height, zoneName, sources)
local name = parent:GetName() .. "Button" .. progress
local text = ""
local found = ""
if not parent[name] then
parent[name] = CreateFrame("Button", parent:GetName() .. "Button" .. progress, parent)
parent[name].t = parent[name]:CreateFontString(nil, "OVERLAY", "GameFontNormal")
else parent[name]:Show() end
if id ~= -1 then
if parent:GetName() == "PileSeller_ConfigFrame_SavedScrollContent" then
if psItemsSavedFound[id] then found = " " .. checkIcon end
end
local n, l, q, _t, _t, _t, _t, _t, _t, _t, _t = GetItemInfo(id)
text = n
-- select text color
qualities = {}
qualities[0] = { r = 0.615, g = 0.615, b = 0.615}
qualities[1] = { r = 1, g = 1, b = 1}
qualities[2] = { r = .118, g = 1, b = 0}
qualities[3] = { r = 0, g = .439, b = 1}
qualities[4] = { r = .639, g = .207, b = .933}
qualities[5] = { r = 1, g = .501, b = 0}
qualities[6] = { r = .901, g = .800, b = .501}
if q >= 6 then q = qualities[6]
else q = qualities[q] end
parent[name].t:SetTextColor(q.r, q.g, q.b)
parent[name]:SetScript("OnEnter", function()
GameTooltip:SetOwner(parent[name], "ANCHOR_BOTTOMRIGHT", 0, parent[name]:GetHeight())
GameTooltip:SetHyperlink(l)
GameTooltip:Show()
end)
parent[name]:SetScript("OnLeave", function()
GameTooltip:Hide()
end)
PileSeller:debugprint(parent:GetName())
if parent:GetName() ~= "PileSeller_SellingBoxFrame_ScrollContent" then
parent[name]:SetScript("OnClick", function()
lastClicked = parent
PileSeller:SetItemInfo(PileSeller.UIConfig.itemInfos.item, id)
if IsShiftKeyDown() then
ChatEdit_InsertLink(l)
elseif IsControlKeyDown() then
DressUpItemLink(l)
end
end)
else
parent[name]:RegisterForClicks("AnyDown")
parent[name]:SetScript("OnClick", function(self, button)
if IsShiftKeyDown() then
ChatEdit_InsertLink(l)
elseif IsControlKeyDown() then
DressUpItemLink(l)
end
if button == "RightButton" then
PileSeller:debugprint("banana")
PileSeller:removeItem(l, psItems, parent)
_G["PileSeller_SellingBoxFrame"]:Hide()
_G["PileSeller_SellingBoxFrame"]:Show()
end
end)
end
elseif id == -1 then
text = zoneName
if parent:GetName() ~= "PileSeller_ConfigFrame_ItemInfos_MiniDialog_ScrollFrameContent" then
parent[name]:SetScript("OnClick", function()
PileSeller.UIConfig.txtAddIgnoreZone:SetText(text)
end)
else
if text == TRANSMOG_SOURCE_1 then
parent[name]:SetScript("OnEnter", function()
PileSeller:CreateTooltipInfo(parent[name], sources)
end)
parent[name]:SetScript("OnLeave", function() GameTooltip:Hide() end)
end
end
end
parent[name].t:SetText(text .. found)
parent[name].t:SetPoint("LEFT", parent[name])
parent[name].t:SetSize(width, height)
parent[name]:SetSize(width, height)
parent[name]:SetHighlightTexture("Interface\\AddOns\\PileSeller\\media\\highlight", "ADD")
parent[name]:SetBackdrop({
bgFile = [[Interface\Buttons\WHITE8X8]],
})
if progress % 2 == 0 or progress == 0 then parent[name]:SetBackdropColor(.15, .15, .15,1)
else parent[name]:SetBackdropColor(.27, .27, .27,1) end
if progress == 1 then parent[name]:SetPoint("TOPLEFT", parent, 1, -1)
else parent[name]:SetPoint("TOPLEFT", parent, 1, -height * (progress - 1) - 1) end
end
Fullscreen reader:
http://hastebin.com/ofabamabak.lua
Did something change with these APIs in 7.1 or am I missing something?
To make some context, the first function it's used whenever the UI it's loaded for the first time, the second one it's used whenever I'm filling these lists.