View Single Post
08/29/19, 09:52 AM   #10
sirinsidiator
 
sirinsidiator's Avatar
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 1,566
You forgot to set a color, so you can likely just not see it.
Lua Code:
  1. label:SetColor(ZO_NORMAL_TEXT:UnpackRGBA())

Some tips:
Don't access the dataTypes table directly, instead use ZO_ScrollList_GetDataTypeTable:
Lua Code:
  1. local SEARCH_RESULTS_DATA_TYPE = 1
  2. local searchResultDataType = ZO_ScrollList_GetDataTypeTable(TRADING_HOUSE.searchResultsList, SEARCH_RESULTS_DATA_TYPE)
  3. local originalSearchResultSetupCallback = searchResultDataType.setupCallback
  4. searchResultDataType.setupCallback = function(rowControl, result)
  5.     originalSearchResultSetupCallback(rowControl, result)
  6. ...

The setup callback is called every time the row is used, which means with your current code you are leaking controls, since they cannot be destroyed. You should instead check if the control already exists and only create it when needed:

Lua Code:
  1. local label = rowControl.myAddOnLabel -- pick some unique name so other addons won't collide with it
  2. if(not label) then
  3.     label = rowControl:CreateControl("$(parent)MyAddOnLabel", CT_LABEL) -- you can just use the parent name to avoid having to ensure a unique name yourself
  4.     label:SetFont("ZoFontGameLargeBold")
  5.     label:SetColor(ZO_NORMAL_TEXT:UnpackRGBA())
  6.     label:SetAnchor(CENTER, rowControl, CENTER, 50, 0)
  7.     rowControl.myAddOnLabel = label
  8. end
  9. label:SetText(slot.purchasePrice)
  Reply With Quote