Hi all
I want to build a little frame factory; I am tired of building each fame template to see which frame I like for various addons; so I figure that I can use a factory to build and then screenshot the frames.
I have a static number 1 frame and I want the following frames using the static frame as the origin.
I want each frame to display its frame template name.
Here is an image of my desired out come.
Here is my code:
Lua Code:
local frameList = {
UIDropDownCustomMenuEntryTemplate,
UIDropDownListTemplate,
UIDropDownMenuButtonTemplate,
UIDropDownMenuTemplate,
UIExpandingButtonTemplate,
UIGoldBorderButtonTemplate,
UIMenuButtonStretchTemplate,
UIMenuButtonTemplate,
UIMenuTemplate,
UIPanelBorderedButtonTemplate,
UIPanelButtonGrayTemplate,
UIPanelButtonNoTooltipResizeToFitTemplate,
UIPanelButtonNoTooltipTemplate,
UIPanelButtonTemplate,
UIPanelCloseButton,
UIPanelCloseButtonNoScripts,
UIPanelDialogTemplate,
UIPanelDynamicResizeButtonTemplate
}
local right, down = 50, -50
local width, height = 300, 150
local frameNameTop, frameLast, frameCount = "staticTopFrame", "staticTopFrame", 2
local function layoutFrames()
for k, v in pairs(frameList) do
f = CreateFrame("Frame", "frame" .. k, UIParent, v)
f:SetSize(width, height)
f:SetPoint("TOPLEFT", frameLast, right, down)
ftb = CreateFrame("Frame", "ftb", f)
ftb:SetSize(width, height / 2)
ftb:SetPoint("CENTER", frameLast)
ftbt = ftb:CreateFontString("ftbt")
ftbt:SetAllPoints(ftb)
ftbt:SetFontObject(FocusFontSmall)
ftbt:SetText(v)
frameLast = frameLast .. k
down = down - 310
if k == 4 then
right = right + 310
down = -50
count = 1
frameNameTop = frameLast
elseif k == 1 then
frameNameTop = frameLast .. k
down = down - 160
else
frameLast = frameLast .. k
down = down - 160
end
end
end
local staticTopFrame = CreateFrame("Frame", "staticTopFrame", UIParent, "UIPanelDialogTemplate")
staticTopFrame:SetSize(width, height)
staticTopFrame:SetPoint("TOPLEFT", right, down)
staticTopFrame:EnableMouse(true)
staticTopFrame:SetMovable(true)
staticTopFrame:SetClampedToScreen(true)
staticTopFrame:RegisterForDrag("RightButton", "LeftButton")
staticTopFrame:SetScript("OnDragStart", staticTopFrame.StartMoving)
staticTopFrame:SetScript("OnDragStop", staticTopFrame.StopMovingOrSizing)
staticTopFrameTextBox = CreateFrame("Frame", "staticTopFrameTextBox", staticTopFrame)
staticTopFrameTextBox:SetSize(width, height / 2)
staticTopFrameTextBox:SetPoint("CENTER", staticTopFrame)
staticTopFrameTextBoxText = staticTopFrameTextBox:CreateFontString(staticTopFrameTextBoxText)
staticTopFrameTextBoxText:SetAllPoints(staticTopFrameTextBox)
staticTopFrameTextBoxText:SetFontObject(FocusFontSmall)
staticTopFrameTextBoxText:SetText("UIPanelDialogTemplate")
layoutFrames()
When I run it the static frame displays correctly yet nothing else displays and there are no errors.
I am using ReHack to run the code in game.
I have looked at button factories and have followed them without success.
There is obviously an error in my code yet I can't see it, maybe I am too close to the code that I can not see the error that I am making.
Any help would be greatly appreciated.