Any way to make buttons activate on both down and up press?

I’ve seen button:RegisterForClicks(“AnyDown”,“AnyUp”) but I don’t know how to implement that to my bars.

I tried /run button:RegisterForClicks(“AnyDown”,“AnyUp”) and it didn’t work.

button: in this case is a generic placeholder. you need the actual name of the button frame to go in there for it to actually work. which means youre going to have to repeat it for every button object you want altered.

you can use /fstack to toggle frame stack viewing which will tell you the name of whatever frames you are hovering over.

depending on how the button is currently processing clicks you may need to add more (secure) code to the button so it can handle those new click types.

do you mean the default action bar buttons or an action bar mod of some sort?

1 Like

The default action bars. It’s mostly to help with latency and with castsequence type macros with lots of presses.

I tried as a test /run ActionButton1:registerforclicks but it didn’t work on my frist keybind. Am I typing this in corectly?

i have stealth on button 10 and after typing in /run ActionButton10:RegisterForClicks("AnyUp","AnyDown") it now kicks in if i click and hold (so down click) and if i wait long enough (for the gcd to complete) and unclick then i exit stealth (as it triggered the up click)

so be careful that you could potentially trigger something twice, once on the down click and once on the up click, depending on gcd and whats assigned to that action button

also note that youve probably tainted the action button and it may cause issues in combat

ActionButton1:RegisterForClicks(“AnyDown”,“AnyUp”) works on clicks, but not on keybinds already made in Bindings.xml. To see, run the RegisterForClicks and put this macro in ActionButton1:

/run print(IsMouseButtonDown())

It works when you click with the mouse button, but not with a key binding.

To get a binding to run on key down and up, you need the binding to be runOnUp.

I think I said recently that default ActionButton bindings weren’t runOnUp but that’s actually incorrect; there’s a cvar ActionButtonUseKeyDown that does stuff when the key goes down so they’re runOnUp and then choose to do stuff on the key down or the key up, depending on that cvar. So they’re runOnUp but do stuff in one or the other but not both depending on that cvar. (If that cvar is not protected you could probably get away with changing it. My quick tests didn’t work and I don’t have time to research how to make it work.)

There are a few solutions, but an easy one is to make another button and then set a binding to that button to click ActionButton1. The following uses an override binding and RegisterForClicks but you can probably achieve a simpler result in a bindings.xml CLICK name.

local button = CreateFrame("Button", "ActionButton1OnUp", UIParent, "SecureActionButtonTemplate")
button:SetAttribute("type","macro")
button:SetAttribute("macrotext","/click ActionButton1")
button:RegisterForClicks("AnyDown","AnyUp")
SetOverrideBindingClick(button,false,"1","ActionButton1OnUp")

This will make the 1 key /click ActionButton1 when the key goes down and up. (Interestingly, a clickbutton was triggering an IsForbidden error, but I don’t have time to look into it too deeply.)

1 Like

Yeah that was the issue. I can confirm it only worked on actual mouse clicks and not bind presses. I made an lua with this and renamed it to the keys I wanted. Works well, thanks dude.