View Single Post
11-22-17, 01:27 PM   #3
Marsgames
An Aku'mai Servant
 
Marsgames's Avatar
Join Date: Jul 2016
Posts: 33
Arrow Fix C Stack Overflow overlay

Ok, for those who have same issue when creating overlay, I fixed it with this code

Lua Code:
  1. function poseDot()
  2.     for bag = 0,4 do
  3.         for slot = 1, GetContainerNumSlots(bag) do
  4.  
  5.             local myBag = bag+1
  6.             local mySlot = GetContainerNumSlots(bag) - (slot - 1)
  7.             local button = _G["ContainerFrame"..myBag.."Item"..mySlot]
  8.  
  9.             if button.overlay then
  10.                 button.overlay:SetShown(false)
  11.                 button.overlay = nil
  12.             end
  13.  
  14.             local itemLink = GetContainerItemLink(bag, slot)
  15.             if itemLink then
  16.  
  17.                 local weightCalcResult = weightCalculation(itemLink)
  18.                 if weightCalcResult[1] ~= nil and weightCalcResult[1] > 0 or weightCalcResult[2] ~= nil and weightCalcResult[2] > 0 then
  19.  
  20.                     -- create overlay texture if it doesn't exit for the button
  21.                     if not button.overlay then
  22.                         button.overlay = button:CreateTexture(nil,"OVERLAY")
  23.                         button.overlay:SetSize(18,18)
  24.                         button.overlay:SetPoint("TOPLEFT")
  25.                         button.overlay:SetTexture("Interface\\AddOns\\GearHelper\\Textures\\flecheUp")
  26.                         --button.overlay:SetTexture("Interface\\Common\\Indicator-Green")
  27.                         button.overlay:SetShown(true)
  28.                     end
  29.                 end
  30.  
  31.             end
  32.  
  33.         end
  34.     end
  35.     ContainerFrame_UpdateAll()
  36. end

and I call my function in
function allEvents:ITEM_PUSH( bag, icone )
and
function allEvents:BAG_UPDATE( bagID )
  Reply With Quote