TTT AddColumn Help

I’ve made additions to Rejax’s EasyScoreboard, but I’ve been trying to get silkicons to work smoothly. Note that I am using the latest update on Github which allows width adjustment.

Current issue:
Another issue I’m coming across is when I change usergroup they’ll keep the old icon until the scoreboard refreshs (round end or map change) unless I use the refresh command to recreate the scoreboard.

http://puu.sh/8UBvu.jpg

[lua]local function AddIcon( sb )
sb:AddColumn( “Icon”, function( ply, label )
local rank = SB.Ranks[GetKey( ply )]
if not rank then return “” end

	local icon = vgui.Create( "DImage", label:GetParent() )
	icon:SetImage(rank.icon)
	icon:SetImageColor(Color(255, 255, 255, 255))
	icon:SetSize(16, 16)
	icon:SetPos(icon:SetPos(label:GetPos() > 0 and label:GetPos() - 8 or -100 , 4)) -- The original problem was icon:SetPos( label:GetPos() - 8, 4 )

	return ""
end, 48)

end

hook.Add( “TTTScoreboardColumns”, “SB_AddColumns”, AddIcon)
[/lua]

SOLVED:

Perhaps you are executing label:GetPos() before it’s pos is being set.

Well I solved that by forcing the img to be drawn off the panel if it is not in the proper position, my second issue was updating / removing the old image when the players rank changes.

I’ve been unable to come up with a solution to clear the previous icon although this is not as much of an issue.