ACTIONBAR_SLOT_CHANGED and the actionbutton frame

On event ACTIONBAR_SLOT_CHANGED gives arg1 as the action_bar_slot_id which appears to be 1-120.
How do I get the actual actionbutton frame from that ID?
As best I can tell I need to check which group it belongs to, then request the actionbutton global name. Something like MultiBarLeftButtonX
So slot_id 38 would mean MultiBarLeftButton2.

It seems to me there must be a better way.

There is. Get a bar mod - either Bartender or use the Bars option in ElvUI.

The mapping between buttons and action slots in the vanilla UI is a hot mess.

For one thing, all of the “bars” in the multi-bar section share action slots when active, so whatever is in the first position for bars one, two, three etc. all are the same action slot number.

If you use a bar mod and don’t configure it for multi-bar usage, every button has its own action slot.

That’s MUCH simpler to manage if you’re tracking things by action slot.

Somewhere I’ve got code that’ll reveal what action slot is attached to which button, but I don’t have it in front of me and can’t recall it. But I’ll dig around (bear in mind - this would be for ElvUI only - I don’t use Bartender or the default UI).

I ended up writing my own function to map from the action_slot# to the actual ActionButton on screen… at least with the standard UI anyways.
It actually didn’t turn out to be that complicated… it just seems really silly that there isn’t a built in way to find it.

Yeah, the issue is that there is not a 1:1 relationship between action slots and action buttons because the buttons are the position on the screen and the slots are places where spells and abilities and macros live.

Because of the multi-bar thing, there are situations where the action SLOTS are reused between different action BUTTONS.

It gets complicated if you’re attempting to do anything based on the slots.