WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Legion Beta archived threads (https://www.wowinterface.com/forums/forumdisplay.php?f=177)
-   -   Mouse Events and ScrollFrames being broken in 7.1 (https://www.wowinterface.com/forums/showthread.php?t=54822)

Infus 11-12-16 10:55 AM

Mouse Events and ScrollFrames being broken in 7.1
 
This code creates a scrollframe and 10 buttons inside that scrollframe. Those buttons are clipped by the scrollframe. And thus only the top 3.5 are visible. In 7.1, the scrollframe no longer clips mouse events, thus clicking on the empty space below the scrollframe registers as clicks on invisible buttons.

Code:

local scrollframe = CreateFrame("ScrollFrame", nil, UIParent)
scrollframe:SetWidth(128);
scrollframe:SetHeight(420);
scrollframe:SetPoint("CENTER");

local content = CreateFrame("Frame", nil, scrollframe)
content:SetPoint("TOPLEFT")
content:SetPoint("TOPRIGHT")
content:SetHeight(1280)
content:SetWidth(128);
scrollframe:SetScrollChild(content)

for i = 0, 10 do
  local button = CreateFrame("BUTTON", nil, content);
  button:SetHeight(128);
  button:SetWidth(128);

  local texture = button:CreateTexture(nil, "OVERLAY");
  texture:SetAllPoints()
  texture:SetTexture("Interface\\PVPFrame\\Icons\\PVP-Banner-Emblem-46");

  button:SetPoint("TOPLEFT", content, "TOPLEFT", 0, -i*128);

  button:SetScript("OnEnter", function() print("hover") end);
  button:SetScript("OnClick", function() print("CLICKED") end);
end


Lombra 11-12-16 12:31 PM

Try :SetClipsChildren(true) on either the scroll frame or the frame. Thought I would've thought real scroll frames already did that. Have not looked into how that's implemented.


All times are GMT -6. The time now is 06:31 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI