WoWInterface - View Single Post - Is is possible to has a OnEnter Script and propagate or unregister mouse clicks?
View Single Post
05-07-21, 07:49 AM   #8
nUI Maintainer
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,641
So, even though you later disable the mouse, because you have set up the scripts it will work for those actions ? And, nice find with the SetMouseMotionEnabled function. Not seen that one yet myself.

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.
  Reply With Quote