View Single Post
05-20-21, 06:13 AM   #10
Darkonode
A Murloc Raider
 
Darkonode's Avatar
Join Date: May 2021
Posts: 8
ScrollFrameChild seems to be properly applied to ScrollFrame

So for some reason my ItemScrollFrame doesn't clip my scroll child contents. It's supposed to be done by a single line of code

Code:
tab.ItemScrollFrame:SetScrollChild(tab.ItemScrollFrameChild)
but it doesn't. The green area in the screenshot is my scroll frame.
https://imgur.com/a/cyI4DfQ

I've created my buttons so all of them are parented to the scroll frame

Code:
	local ButtonIndex = {}
	local index = 1
	local first_elem = true
	for key, item in next, namespace.searchResult do
		local buttonName = key .. "Button"
		if first_elem then
			tab.buttonName = CreateFrame("Button", buttonName, tab.ItemScrollFrame, "OptionsListButtonTemplate")
			tab.buttonName:SetPoint("TOPLEFT", tab.ItemScrollFrameChild, "TOPLEFT", 4, -4)
			tab.buttonName:SetSize(192, 10)
			tab.buttonName:SetHighlightTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2")
			tab.buttonName:SetText(item.name)
			if item.slot then
				tab.buttonName.tooltipText = item.itemType .. ", " .. item.slot
			else
				tab.buttonName.tooltipText = item.itemType
			end
			tab.buttonName:SetScript("OnEnter", OnEnter)
			tab.buttonName:SetScript("OnLeave", OnLeave)
			tab.buttonName:SetScript("OnClick", OnClickItemFrameButton)
			table.insert(ButtonIndex, buttonName)
			index = index + 1
			first_elem = false
		else
			tab.buttonName = CreateFrame("Button", buttonName, tab.ItemScrollFrame, "OptionsListButtonTemplate")
			tab.buttonName:SetPoint("TOPLEFT", ButtonIndex[index - 1], "TOPLEFT", 0, -11)
			tab.buttonName:SetSize(192, 10)
			tab.buttonName:SetHighlightTexture("Interface\\BUTTONS\\UI-Listbox-Highlight2")
			tab.buttonName:SetText(item.name)
			if item.slot then
				tab.buttonName.tooltipText = item.itemType .. ", " .. item.slot
			else
				tab.buttonName.tooltipText = item.itemType
			end
			tab.buttonName:SetScript("OnEnter", OnEnter)
			tab.buttonName:SetScript("OnLeave", OnLeave)
			tab.buttonName:SetScript("OnClick", OnClickItemFrameButton)
			table.insert(ButtonIndex, buttonName)
			index = index + 1
		end
	end
	tab.ItemScrollFrameChild:SetSize(190, index * 11)
Attached Files
File Type: lua config.lua (9.1 KB, 95 views)

Last edited by Darkonode : 05-20-21 at 07:04 AM.
  Reply With Quote