View Single Post
08-08-16, 02:54 PM   #1
Infus
A Deviate Faerie Dragon
Join Date: Jul 2016
Posts: 13
ScrollFrame clipping issue

The following code that was extracted from WeakAuras + AceGui shows rather strange behaviour.

There are nested scroll frames, the inner scrollframes are 32x32 pixels and should clip the contained text, but apparently that doesn't work correctly.


Code:
-- First scroll frame
local scrollframe = CreateFrame("ScrollFrame", nil, UIParent)
scrollframe:SetBackdrop({
  bgFile = "Interface\\DialogFrame\\UI-DialogBox-Background",
  edgeFile = "Interface\\DialogFrame\\UI-DialogBox-Border",
  tile = true,
  tileSize = 32,
  edgeSize = 32,
  insets = { left = 8, right = 8, top = 8, bottom = 8 }
});

scrollframe:SetPoint("CENTER", UIParent, "CENTER");
scrollframe:SetWidth(630);
scrollframe:SetHeight(492);

-- Scroll child of first scroll frame
local content = CreateFrame("Frame", nil, scrollframe)
content:SetHeight(800)
scrollframe:SetScrollChild(content)

content:ClearAllPoints()
content:SetPoint("TOPLEFT", 0, 0)
content:SetPoint("TOPRIGHT", 0, 0)

-- Create 20 scrollframes
local children = {};
local lastChild;
for i = 1, 20 do
  local child = CreateFrame("ScrollFrame", nil, content);
  child:SetWidth(32);
  child:SetHeight(32);

  local scrollChild = CreateFrame("Frame", nil, child);
  scrollChild:SetWidth(28);
  scrollChild:SetHeight(28);
  child:SetScrollChild(scrollChild);

  local text = scrollChild:CreateFontString(nil, "OVERLAY");
  text:SetPoint("CENTER", scrollChild, "CENTER");
  text:SetFont("Fonts\\ARIALN.TTF", 36, "OUTLINE");
  text:SetText("|TInterface\\Icons\\inv_misc_coin_17:12:12|t");

  if (lastChild) then
    child:SetPoint("TOPLEFT", lastChild, "BOTTOMLEFT")
  else
    child:SetPoint("TOPLEFT", content)
  end
  lastChild = child;
end