WoWInterface - View Single Post - Addon for selecting assigning specific targets
View Single Post
03-09-18, 02:20 PM   #8
A Scalebane Royal Guard
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 429
While you can certainly do something like this:
Lua Code:
  1. local Button = CreateFrame('Button', 'WhateverYouWannaCallIt', nil, 'SecureHandlerStateTemplate, SecureActionButtonTemplate')
  3. Button:SetAttribute('type', 'focus')
  4. Button:SetAttribute('unit', 'mouseover')
  6. RegisterStateDriver(Button, 'friendlymouse', '[@mouseover,help]true;nil')
  7. Button:SetAttribute('_onstate-friendlymouse', [[
  8.     if newstate then
  9.         self:SetBindingClick(true, 'BUTTON1', self:GetName())
  10.     else
  11.         self:ClearBindings()
  12.     end
  13. ]])

...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:
  1. unitFrame:SetAttribute('type', 'focus')

Last edited by MunkDev : 03-09-18 at 02:26 PM.
  Reply With Quote