While you can certainly do something like this:
Lua Code:
local Button = CreateFrame('Button', 'WhateverYouWannaCallIt', nil, 'SecureHandlerStateTemplate, SecureActionButtonTemplate')
Button:SetAttribute('type', 'focus')
Button:SetAttribute('unit', 'mouseover')
RegisterStateDriver(Button, 'friendlymouse', '[@mouseover,help]true;nil')
Button:SetAttribute('_onstate-friendlymouse', [[
if newstate then
self:SetBindingClick(true, 'BUTTON1', self:GetName())
else
self:ClearBindings()
end
]])
...it doesn't change the fact that
unit frames will consume your left click. Even if you set left mouse button to focus, your "focus button" won't receive the click because there's a unit frame in the way that doesn't propagate it further. You can use this for any other key binding and it will work, but mouse buttons retain their UI functionality if you're mousing over a mouse-enabled widget, even with overrides.
The only solution AFAIK is to use the state driver above
and set each of your unit frames like so:
Lua Code:
unitFrame:SetAttribute('type', 'focus')