Hey!
I'm kinda new to LUA coding and I'm currently trying to create a frame strip to the left of my PitBull4 party frames and when a player joins my party I want that frame to expand automatically without having to reload my UI.
Current Code:
Code:
function P:OnEnable()
local frame = CreateFrame("Frame", nil, PitBull4_Groups_Party)
frame:SetHeight(P:CalculateHeight()) -- Set Height of the frame automatically
frame:SetWidth(3)
frame:SetPoint("LEFT", -10, 0, "CENTER", 0, 0)
-- Instead of using a backdrop, I create a texture as the background
frame.bg = frame:CreateTexture(nil, "BACKGROUND")
frame.bg:SetAllPoints(frame)
frame.bg:SetTexture("Interface/Tooltips/UI-Tooltip-Background")
frame.bg:SetGradientAlpha("VERTICAL", 0, 0, 0, 1, 0, 0, 0, 1)
frame:RegisterEvent("PARTY_MEMBERS_CHANGED", function() frame:SetHeight(P:CalculateHeight()); end)
end
function P:CalculateHeight()
members = GetNumGroupMembers();
-- (frame height + padding top + padding bottom) * party member count
return (12 + 5 + 5) * members
end
Any suggestion how to do this? It works if I reload my UI each time someone joins, but I want it to update automatically so I don't need to reload my ui each time :P
Thanks!