Jump to content
Sign in to follow this  
shuraken007

AddonCraft Questions

Recommended Posts

So.. mine first question.

 

How to solve problem with elements out of scrollframe (but they are in scrollchild) which catch mouse events?

 

look at this picture:

scrollchild contains 5 long buttons, which width is more, then width of scrollframe

and button become highlighting when mouse is righter then end of the scrollframe (near with scrollbar = slider)

http://prntscr.com/dai2ik

and when I scroll frame - button start catch mouse events from the left side (out of the scrollframe too)

http://prntscr.com/dai308

 

(I meaned horizontal scroll)

Edited by shuraken007

Share this post


Link to post
Share on other sites

I think that the simplest version will look like next func

function BuildTestScrollFrame()
	-----child
	local child = CreateFrame("Frame","TestChild", UIParent)
	child:SetWidth(300)
	child:SetHeight(200)
	local t = child:CreateTexture(nil, "BACKGROUND")
	t:SetTexture("Interface\\RaidFrame\\UI-RaidFrame-GroupBg.blp")
	t:SetAllPoints(child)
	child.texture = t
	-----ScrollFrame
	local ScrFrame = CreateFrame("ScrollFrame","TestScrollFrame",UIParent)
	ScrFrame:SetWidth(200)
	ScrFrame:SetHeight(200)
	ScrFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
	----Add child to ScrollFrame
	child:SetAllPoints(parent)
	ScrFrame:SetScrollChild(child)
	----Slider
	local slider = CreateFrame("Slider", "TestSlider", ScrFrame)
	slider:SetBackdrop( { 
		  bgFile = "Interface\\Buttons\\UI-SliderBar-Background", 
		  edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", 
		  tile = true, tileSize = 8, edgeSize = 8, 
		  insets = { left = 3, right = 3, top = 6, bottom = 6 }})
	slider:SetOrientation("HORIZONTAL")
	slider:SetMinMaxValues(0, 300)
	slider:SetValue(0)
	slider:SetValueStep(1)
	slider:SetWidth(200)
	slider:SetHeight(25)
	slider:SetPoint("TOP", ScrFrame, "BOTTOM")
	slider:SetScript("OnValueChanged", 
		function()
			this:GetParent():SetHorizontalScroll(-1 * this:GetValue())
		end
	)
	slider:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob")
	---Button
	local testbutton = CreateFrame("Button" ,"TestButton", child, "UIPanelButtonTemplate")
	testbutton:SetWidth(300)
	testbutton:SetHeight(30)
	testbutton:EnableMouse(true)
	testbutton:SetPoint("LEFT", child, "LEFT", 10, 0)
end

http://prntscr.com/daj650

move mouse to that place where button cut - it will fire, it will be clickable there

http://prntscr.com/daj70q

Edited by shuraken007

Share this post


Link to post
Share on other sites

try this:

function BuildTestScrollFrame()
	-----ScrollFrame
	local ScrFrame = CreateFrame("ScrollFrame","TestScrollFrame",UIParent)
	ScrFrame:SetWidth(200)
	ScrFrame:SetHeight(200)
	ScrFrame:SetPoint("CENTER", UIParent, "CENTER", 0, 0)
	----Add child to ScrollFrame
	-----child
	local child = CreateFrame("Frame","TestChild", ScrFrame)
	child:SetWidth(300)
	child:SetHeight(200)
	child.texture = child:CreateTexture(nil, "BACKGROUND")
	child.texture:SetTexture("Interface\\RaidFrame\\UI-RaidFrame-GroupBg.blp")
	child.texture:SetAllPoints(child)
	--child:SetAllPoints(parent) ?? parent ??
	ScrFrame:SetScrollChild(child)
	----Slider
	local slider = CreateFrame("Slider", "TestSlider", ScrFrame)
	slider:SetBackdrop( { 
		  bgFile = "Interface\\Buttons\\UI-SliderBar-Background", 
		  edgeFile = "Interface\\Buttons\\UI-SliderBar-Border", 
		  tile = true, tileSize = 8, edgeSize = 8, 
		  insets = { left = 3, right = 3, top = 6, bottom = 6 }})
	slider:SetOrientation("HORIZONTAL")
	slider:SetMinMaxValues(0, 300)
	slider:SetValue(0)
	slider:SetValueStep(1)
	slider:SetWidth(200)
	slider:SetHeight(25)
	slider:SetPoint("TOP", ScrFrame, "BOTTOM")
	slider:SetScript("OnValueChanged", 
		function()
			this:GetParent():SetHorizontalScroll(-1 * this:GetValue())
		end
	)
	slider:SetThumbTexture("Interface\\Buttons\\UI-ScrollBar-Knob")
	---Button
	local testbutton = CreateFrame("Button" ,"TestButton", child, "UIPanelButtonTemplate")
	testbutton:SetWidth(300)
	testbutton:SetHeight(30)
	testbutton:EnableMouse(true)
	testbutton:SetPoint("LEFT", child, "LEFT", 10, 0)
end

what did i do? changed the parent of the child to the scrollframe instead to UIParent

Share this post


Link to post
Share on other sites

nothing happend, have you tested?

child:SetAllPoints(ScrFrame)

made mistake on collecting pieces of code, parent was param in func

Edited by shuraken007

Share this post


Link to post
Share on other sites

nothing happend, have you tested?

child:SetAllPoints(ScrFrame)

made mistake on collecting pieces of code, parent was param in func

yes, i tested it and it solves your problem...

FWU2Inb.png

Share this post


Link to post
Share on other sites

Thank you, it's work. (probably havn't resave file last time)

Killed 3 hours I think. 

Try other versions with changing hitrecktangle of button.

Also tried to set that button to Scrollframe(with const size=width of scrollframe) and all strings on button anchor to child. But labels were on dark fone because button was over it.

Looked through FauxScrollFrame.

So.. thank you one time more).

Edited by shuraken007

Share this post


Link to post
Share on other sites

I love you guys have knowledge about stuffs, if you don't mind i can give you few examples of addons which are forgotten or mainly unknown for many regarding Shadow Priest and Paladin.

 

The existent addons work for TBC++  expansions but for Vanilla there is problem within their own sources.

 

Is it possible for you guys to rework that addons and set them according to Vanilla ?

 

/Kind regards Killerduki

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×