View Single Post
05-10-12, 03:58 PM   #6
lerb
A Frostmaul Preserver
 
lerb's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 264
Hi again Phanx! Hope you don't mind me necroing this thread.

I've been playing around with this again lately and got it working a little bit, but I can't get it to skin all the units. I've used /fstack to find out the names of the frames for the actual units in grid, not the background frame, and tried to attach a beautycase border to them with the beautycase function, which looks like this when I'm using your code;

Code:
		local function Grid_AddBorder(f)
			CreateBorderChat(GridLayoutHeader1UnitButton1, LeUI.media.bordersize, LeUI.bordercolor, LeUI.bordercolor, LeUI.bordercolor, 2)
		end
As you can see, if I hover myself in grid the frame is named GridLayoutHeader1UnitButton1. There was a couple of different frames to choose from but this one worked. Problem is, sometimes there's up to 40 of these. Do you have any clue how I could get a border on every unit? I guess I could create 40 CreateBorder lines, but that doesn't seem to be the correct way to go.

The different frames appearing when hovering the first unit in my party/raid with /fstack is;

1. GridLayoutHeader1UnitButton1
2. GridLayoutHeader1
3. GridLayoutFrame

Here's the full code as it looks right now, I have no way if it is efficient as it is now but at least it's partially working;

Code:
local function SkinGrid()
	local GridFrame = Grid and Grid:GetModule("GridFrame")
	if GridFrame and GridFrame.registeredFrames then
		-- print("Adding borders to Grid frames")

		local function Grid_AddBorder(f)
			CreateBorderChat(GridLayoutHeader1UnitButton1, LeUI.media.bordersize, LeUI.bordercolor, LeUI.bordercolor, LeUI.bordercolor, 2)
		end

		local o = GridFrame.RegisterFrame
		GridFrame.RegisterFrame = function(self, f)
			o(self, f)
			Grid_AddBorder(f)
		end

		return true
	end
end

if not SkinGrid() then
	local f = CreateFrame("Frame")
	f:RegisterEvent("ADDON_LOADED")
	f:RegisterEvent("PLAYER_LOGIN")
	f:SetScript("OnEvent", function()
		if SkinGrid() then
			f:UnregisterAllEvents()
			f:SetScript("OnEvent", nil)
			SkinGrid = nil
		end
	end)
end
And here's a screen to explain what I mean. As you can see, only the first "UnitButton" is skinned.


Last edited by lerb : 05-10-12 at 05:11 PM.
  Reply With Quote