Returns the frame that is currently under the mouse, and has mouse input enabled.


See also Utility functions, Cursor functions.

Signature:

frame = GetMouseFocus()

Returns:

  • frame - The frame that currently has the mouse focus (table)

Examples:

-- Returns the name of the frame under the mouse, if it's named
local frame = GetMouseFocus()
if not frame then
  ChatFrame1:AddMessage("There is no mouse enabled frame under the cursor")
else
  local name = frame:GetName() or tostring(frame)
  ChatFrame1:AddMessage(name .. " has the mouse focus")
end