So, I have this snippet of code that worked well when it was a SetBindingSpell, but now that I have switched over to using a macro, it just doesn’t fire off. The idea here was to create a series of frames that let me cast spells using the mouse wheel instead of via clicking.
frame = CreateFrame("Button",frameName,UIParent,"SecureHandlerEnterLeaveTemplate")
frame:SetAlpha(.15)
frame:SetPoint(position,0,0)
frame:SetPropagateKeyboardInput(true)
frame:RegisterForClicks("AnyUp","AnyDown")
frame:SetAttribute("type", "macro")
frame:SetNormalTexture((GetSpellTexture(spellName)) or "Interface\\Icons\\INV_Misc_QuestionMark")
frame:SetAttribute("macrotext", "/cast " .. spellName)
frame:SetAttribute("_onenter",[[
self:SetBindingMacro(true,"MOUSEWHEELUP",self:GetAttribute("macrotext"))
print(self:GetAttribute("macrotext"))
]])
So, the mouse enters the frame, the binding is set, and then mousewheelup makes it cast the given spell. And “spellName” here could be anything-- Flash of Light for example.
This is what that snippet looked like previously when it worked using just a spell, and not a macro:
frame = CreateFrame("Button",frameName,UIParent,"SecureHandlerEnterLeaveTemplate")
frame:SetAlpha(.15)
frame:SetPoint(position,0,0)
frame:SetPropagateKeyboardInput(true)
frame:RegisterForClicks("AnyUp","AnyDown")
frame:SetAttribute("spell", spellName)
frame:SetNormalTexture((GetSpellTexture(spellName)) or "Interface\\Icons\\INV_Misc_QuestionMark")
frame:SetAttribute("_onenter",[[
self:SetBindingSpell(true,"MOUSEWHEELUP",self:GetAttribute("spell"))
]])
Any ideas?