Run when the frame receives a mouse wheel scrolling action. In order for this handler to be run, the frame must be mouse wheel enabled and the mouse cursor must be within the frame while the scroll wheel (or equivalent device) is used.

Signature:

OnMouseWheel(self, delta)

Arguments:

  • self - Reference to the widget for which the script was run (frame)
  • delta - 1 for a scroll-up action, -1 for a scroll-down action (number)

Examples:

-- Print the mousewheel delta for a button
CreateFrame("Frame", "test", UIParent, "UIPanelButtonTemplate")
test:SetPoint("CENTER")
test:EnableMouseWheel(true)
test:SetScript("OnMouseWheel", function(self, delta)
      DEFAULT_CHAT_FRAME:AddMessage(delta)
end)