For the past 5-6 years I used a simple addon that allowed me to switch the action bar as long as I press a certain mouse button. As soon as I release the mouse button the bar switches back to default. Unfortunately with each new WoW addon my tiny addon becomes useless again as it just stops working. The past two times I managed it to get it somehow working again. But this time... my lack of knowledge of Lua and the WoW UI API doesn't really help me this time. :(
Anyway, I could post the code that I already have for the 'new' version but it's a lot more messy than the one from the old version. So I will just take the old one and hope that someone can give me a hint (or even the solution ;)) what to do.
function NWNBarSetButtonAttributes(name, frame, bar, key)
function( self, event, ...)
SetOverrideBindingClick(frame, 0, key, name, "LeftButton");
local name1 = "NWNButton1"
local name2 = "NWNButton2"
local name3 = "NWNButton3"
local nwnButton1 = CreateFrame("Button", name1, UIParent, "SecureActionButtonTemplate")
local nwnButton2 = CreateFrame("Button", name2, UIParent, "SecureActionButtonTemplate")
local nwnButton3 = CreateFrame("Button", name3, UIParent, "SecureActionButtonTemplate")
NWNBarSetButtonAttributes(name1, nwnButton1, 2, "BUTTON4");
NWNBarSetButtonAttributes(name2, nwnButton2, 3, "BUTTON5");
NWNBarSetButtonAttributes(name3, nwnButton3, 4, "BUTTON3");
SecureHandlerWrapScript(nwnButton1, "OnClick", nwnButton1,
owner:SetAttribute("action", down and 2 or 1)
SecureHandlerWrapScript(nwnButton2, "OnClick", nwnButton2,
owner:SetAttribute("action", down and 3 or 1)
SecureHandlerWrapScript(nwnButton3, "OnClick", nwnButton3,
owner:SetAttribute("action", down and 4 or 1)
A few notes:
There is (was) also an xml file that does nothing than defining the NWNBar_OnLoad() function as 'startup' function. In the new version I just create the frame in the lua file.
I also tried using the 'macro' function of Bartender but without success. I asked yesterday in the bartender topic how to achieve what I want but I guess the addon dev probably missed it as he seems to be quite busy right now. :)
(Oh, and it's called NWNBar because the idea is originated from Neverwinter Nights.)