Thread Tools Display Modes
11-12-16, 10:55 AM   #1
Infus
A Deviate Faerie Dragon
Join Date: Jul 2016
Posts: 13
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
 
11-12-16, 12:31 PM   #2
Lombra
A Molten Giant
 
Lombra's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 554
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.
__________________
Grab your sword and fight the Horde!
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » Mouse Events and ScrollFrames being broken in 7.1

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off