API IfMouseIsOver Question

I recommend doing a SetAlpha rather than a Show/Hide.

In principle, yes you can do what you’re after. But in practice some default UI elements like the objective tracker has secure buttons and you will taint them and cause undesirable behavior in combat. Show/Hide is a protected action on secure frames. (Otherwise you could stack all your raid unit frames in one spot and show who needs healed, etc.)

Unlike Show/Hide, SetAlpha is pretty safe to apply to even secure frames. Though of course be careful if they do their own alpha stuff. (Which may happen with the ObjectiveTrackerFrame, but I’m not sure.)

local f = CreateFrame("Frame")
f.objTrackerShown = true
f.objTrackerTimer = 0
f:SetScript("OnUpdate",function(self,elapsed)
  f.objTrackerTimer = f.objTrackerTimer + elapsed
  if f.objTrackerTimer > 0.5 then
    f.objTrackerTimer = 0
    local isOver = MouseIsOver(ObjectiveTrackerFrame)
    if isOver and not f.objTrackerShown then
      f.objTrackerShown = true
      ObjectiveTrackerFrame:SetAlpha(1)
    elseif not isOver and f.objTrackerShown then
      f.objTrackerShown = false
      ObjectiveTrackerFrame:SetAlpha(0)
    end
  end
end)
2 Likes