Helloo
I'm a begginer at addon dev and have a question
I have this code that displays on screen an icon representing the role of each member in the group, now I'm trying to figure out how to append the icons to the default group frames.
Code:
function Test()
for i = 1, GetGroupSize() do
local unitTag = GetGroupUnitTagByIndex(i)
local unitFrame = UNIT_FRAMES:GetFrame(unitTag)
d(unitFrame)
local frameName = "TestFrame" .. i
local GroupMemberFrame = WM:CreateTopLevelWindow(frameName)
GroupMemberFrame:SetDimensions(25, 25)
GroupMemberFrame:ClearAnchors()
GroupMemberFrame:SetMouseEnabled(true)
GroupMemberFrame:SetMovable(true)
GroupMemberFrame:SetHidden(not LGRI.savedVars.visible)
GroupMemberFrame:SetClampedToScreen(true)
GroupMemberFrame:SetHandler("OnMoveStop", function() getPos() end)
GroupMemberRoleIcon = WM:CreateControl(frameName .. "Teste" .. i, GroupMemberFrame, CT_TEXTURE)
GroupMemberRoleIcon:SetDimensions(25, 25)
GroupMemberRoleIcon:SetAnchor(CENTER, GroupMemberFrame, CENTER, 0, 0)
GroupMemberRoleIcon:SetTexture(Group[i].RoleIcon)
GroupMemberFrame:SetAnchor(TOPLEFT, GuiRoot, TOPLEFT, 250, 100 + (i * 40))
end
end
I've tried this but it crashes the game for some reason
Code:
GroupMemberFrame:SetAnchor(TOPLEFT, unitFrame, TOPLEFT, 0, 0)