View Single Post
05-07-21, 09:39 PM   #9
OverCraft
A Murloc Raider
Join Date: May 2021
Posts: 4
Originally Posted by Vrul View Post
Blizzard added that functionality awhile ago:
Lua Code:
  1. local f = CreateFrame("Frame",nil,UIParent)
  2. f.tex = f:CreateTexture()
  3. f.tex:SetAllPoints(f)
  4. f.tex:SetColorTexture(0.5, 0.2, 1 , 0.5)
  5. f:SetSize(300,200)
  6. f:SetPoint("CENTER")
  7. f:SetScript ("OnEnter", function(self) print("OnEnter")  end)
  8. f:SetScript ("OnLeave", function(self) print("OnLeave")  end)
  9. f:EnableMouse(false)
  10. f:SetMouseMotionEnabled(true)
The order of the last four lines is important. Setting a script dealing with the mouse automatically enables the mouse. So set your OnEnter/OnLeave scripts, then disable the mouse, and finally enable motion scripts only.
The @Fizzlemizz OnUpdate idea was good, but a little too agressive. This is actually the cleanest version, very nice trick Thanks everybody for the help!
  Reply With Quote