I think I've read through about a dozen unit/raid frames addons by now (oUF, Grid, Pitbull (aargh), Vuhdo (omgwtf), Healbot, who knows how many others) and I still don't understand how headers get created. I can't find a simplified example online; I have the book from wowprogramming, which does a simple raid frame, but half of it's in XML.
All I want to do (for now) is create a header that displays a frame for each of my raid members when I am in a raid. It doesn't need to do anything yet, I just want it to appear on my screen.
I have the following:
lua Code:
function KaelFrames:Create(unit)
local frame = CreateFrame("Button", "KaelFrames_"..unit, UIParent, "SecureUnitButtonTemplate")
frame.backdrop = CreateFrame("Frame", nil, frame)
SecureUnitButton_OnLoad(frame, unit)
RegisterUnitWatch(frame)
frame.elements = {}
self:ConfigureFrame(frame)
return frame
end
function KaelFrames:CreateHeader(header)
local frame = CreateFrame("Frame", "KaelFrames_"..header, UIParent, "SecureGroupHeaderTemplate")
-- what goes here?
return frame
end
ConfigureFrame() sets the width, height, backdrop, etc. and inherits some functions.
When I feed "player" or "target" or "raid1" into Create(), it produces a clickable frame with a visible backdrop that appears when the unit exists and works for targeting the unit, which is all I expect it to do at this point.
What I would like CreateHeader() to do is, when I feed it "raid", to create a header and call Create() to create a frame for each raid member. Or some equivalent.
I know I need to define the header's initialConfigFunction, which needs to be some sort of superlong string, but I don't know what needs to be in that string and I don't know what else needs to happen.
Can anyone help?