Thread Tools Display Modes
Prev Previous Post   Next Post Next
05-03-21, 09:31 AM   #1
Ylaana
A Murloc Raider
Join Date: May 2021
Posts: 5
HybridScrollFrame row background colour

This is my first addon. I have a list which is basically Meorawr's HybridScrollFrame demo, just with a different dataset.

https://gist.github.com/Meorawr/7d67...7a875db3fd1d7a

If an item's itemName exists within a given itemArray, I want to colour the row background, which I've done like this:

Code:
button.Text:SetText(item.text or "");

local tex = button:CreateTexture(nil, "BACKGROUND")
tex:SetAllPoints()
tex:SetTexture("Interface\\Tooltips\\UI-Tooltip-Background")
tex:SetGradientAlpha("HORIZONTAL", unpack({0.15,0.6,0.15,1, 0.15,0.6,0.15,0}))
button.Texture = tex
button.Texture:Hide()

if ItemExists(itemArray, item.itemName) then
    button.Texture:Show()
end
This puts the background in as expected for the right items on load, but when I scroll down, the coloured background 'sticks' to the top of the list, and ends up colouring the background of the items I scrolled past. I also noticed that some rows appear to get the background applied more than once(?) as the opacity/gradient varies between them. I've attached images of the initial view (1), and what happens when you scroll down (2) and back up (3).

I'd be very grateful if someone could point me in the right direction.
Attached Thumbnails
Click image for larger version

Name:	itemlist1.png
Views:	137
Size:	231.5 KB
ID:	9615  Click image for larger version

Name:	itemlist2.png
Views:	125
Size:	227.4 KB
ID:	9616  Click image for larger version

Name:	itemlist3.png
Views:	113
Size:	230.9 KB
ID:	9617  
  Reply With Quote
 

WoWInterface » Developer Discussions » Lua/XML Help » HybridScrollFrame row background colour


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off