Lua Code:
local function MyAddOn_BuildStanceListItem(f, index, icon, name, active)
local StanceIconFrame = CreateFrame("Frame", nil, f);
f[index] = StanceIconFrame;
StanceIconFrame:SetSize(68, 68);
StanceIconFrame:SetPoint("TOPLEFT", 0, - 68 * (index - 1));
local StanceIcon = StanceIconFrame:CreateTexture(nil, "ARTWORK");
StanceIcon:SetTexture(icon);
StanceIcon:SetAllPoints();
StanceIconFrame.texture = StanceIcon;
f:SetHeight(68 * index);
end
local f = CreateFrame("Frame", "MyAddOnFrame", UIParent, "UIPanelDialogTemplate");
f:SetSize(384, 512);
f:SetPoint("CENTER");
f.Title:ClearAllPoints();
f.Title:SetFontObject("GameFontHighlight");
f.Title:SetPoint("TOPLEFT", f, "TOPLEFT", 12, - 6);
f.Title:SetText("My Awesome AddOn");
f.ScrollFrame = CreateFrame("ScrollFrame", nil, f, "UIPanelScrollFrameTemplate");
f.ScrollFrame:SetPoint("TOPLEFT", f, "TOPLEFT", 14, - 36);
f.ScrollFrame:SetPoint("BOTTOMRIGHT", f, "BOTTOMRIGHT", - 34, 14);
f.ScrollChild = CreateFrame("Frame", nil, f.ScrollFrame)
f.ScrollFrame:SetScrollChild(f.ScrollChild)
f.ScrollChild:SetPoint("TOPLEFT")
f.ScrollChild:SetPoint("RIGHT")
for index = 1, GetNumShapeshiftForms() do
MyAddOn_BuildStanceListItem(f.ScrollChild, index, GetShapeshiftFormInfo(index));
end
A little modification, you need give the container a location and size, so it can be displayed, I attach the container to the topleft and right, so it has width, I update its height in the MyAddOn_BuildStanceListItem, so it has the whole size settings.
You can test more with in-game editor.