I've been trying to figure this out all day so far and despite searching and looking at the official forums and trying the examples in wowwiki and searching and reading here I cannot see what is going wrong with this bit of code.
If I comment out the Inherited Frames from the CreateFrame method and comment out the SetAttribute lines the addon I have displays the action buttons as I expect them. However, with this code as it is, nothing is displayed. I know I will later have to implement special functions to handle clicks ( unless the inherited frames does that too ) but for now I just want to get them displayed.
Can anyone see anything to explain why secure action buttons are not even displayed when normal action buttons do ?
Thanks in advance.
Code:
local function MagePorts_InitPortalButtons()
MagePorts_PortalButtons = {};
for i,v in pairs(MagePorts_PortalDB) do
if ( string.find(v.faction,MagePorts_Faction) ) then
local SpellName = select(1,GetSpellInfo(v.spell));
local Available = ( GetSpellInfo(SpellName) ~= nil );
local ButtonName = "P_" .. v.spell;
local TextureName = ButtonName .. "_Texture";
local IconFile = select(3,GetSpellInfo(v.spell));
local Button = CreateFrame("Button", ButtonName, UIParent,"ActionButtonTemplate,SecureActionButtonTemplate");
Button:SetWidth(36);
Button:SetHeight(36);
local texture = Button:CreateTexture(TextureName,"BACKGROUND");
texture:SetAllPoints(Button);
texture:SetTexture(IconFile);
Button:SetNormalTexture("Interface\\Buttons\\UI-Quickslot2");
Button:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square", add);
Button:SetPushedTexture("Interface\\Buttons\\UI-Quickslot-Depress");
Button:SetAlpha(1.0);
Button:SetAttribute("type","spell");
Button:SetAttribute("spell",SpellName);
table.insert(MagePorts_PortalButtons,Button);
end
end
end