local Background = CreateFrame('Button', name, UIParent)
...
Background:EnableMouse(true)
--Background:SetMovable(true)
--Background:RegisterForDrag('LeftButton')
--Background:SetScript('OnDragStart', function() if IsAltKeyDown() then self.frames[u]:StartMoving() end end)
--Background:SetScript('OnDragStop', function() self.frames[u]:StopMovingOrSizing() self:savePosition() end)
Background:SetScript('OnEnter', function() UnitFrame_OnEnter() end)
Background:SetScript('OnLeave', function() UnitFrame_OnLeave() end)
Background:RegisterForClicks('LeftButtonUp','RightButtonUp','MiddleButtonUp','Button4Up','Button5Up')
Background:SetScript('OnClick', self.OnClick)
...
function idUnitframes:OnClick()
local b,u = arg1, this.unit
if not UnitExists(u) then return end
if UnitIsUnit(u, 'player') then u = 'player' end
if b == 'LeftButton' then
if SpellIsTargeting() then
SpellTargetUnit(u)
elseif CursorHasItem() then
if UnitIsUnit(u, 'player') then
AutoEquipCursorItem()
elseif UnitIsFriend(u, 'player') and UnitIsPlayer(u) then
DropItemOnUnit('target')
end
else
TargetUnit(u)
end
elseif b == 'RightButton' then
u = oUF:strcap(u)
if string.find(u,'Party') then
ToggleDropDownMenu(1, nil, getglobal('PartyMemberFrame'..this:GetID()..'DropDown'), 'cursor', 0, 0)
else
ToggleDropDownMenu(1, nil, getglobal(u..'FrameDropDown'), 'cursor', 0, 0)
end
end
end