ScriptRegion:SetPassThroughButtons

From Warcraft Wiki
Jump to navigation Jump to search

Allows the region to propagate mouse clicks to underlying regions or the world frame.

ScriptRegion:SetPassThroughButtons([button1, ...])

Arguments

button1, ...
string? : LeftButton, RightButton, MiddleButton, Button4, Button5

Details

  • Pass multiple arguments to register several buttons, or none to remove any previous registrations.
  • Subsequent calls replace any prior ones.

Example

Passes through left and middle mouse buttons when clicking the icon, but not the right mouse button.

local f = CreateFrame("Frame", nil, UIParent)
f:SetPoint("CENTER")
f:SetSize(64, 64)

f.tex = f:CreateTexture()
f.tex:SetAllPoints(f)
f.tex:SetTexture("interface/icons/inv_mushroom_11")

f:EnableMouse(true)
f:SetPassThroughButtons("LeftButton", "MiddleButton")

A quirk appears to be when clicking a button that is passed through and not budging the mouse, the next mouse click with any button will also be passed through. E.g. with the above example, doing a left-click and then the right-click still gets passed through.

Patch changes

Dragonflight Patch 10.1.5 (2023-07-11): Restricted. May no longer be called by insecure code while in combat.
Dragonflight Patch 10.0.0 (2022-10-25): Added.