Thread Tools Display Modes
06-21-13, 02:15 AM   #1
Ledii
A Deviate Faerie Dragon
 
Ledii's Avatar
Join Date: Apr 2013
Posts: 10
Need help with a Scrollbar!

Hey, so I wanted a scrollbar for a list I'm making, and as far as I could figure out by many hours at google. The "FauxScrollFrameTemplate" was the easies way to go?

Anyways, I have set it up where I want, the objects (buttons) pop up where the should, all good. But the problem I'm having is that I can't get to run any update events becuase my scollbar is all gray and seems to be in a state of being 100% scrolled in both directions. Therefor I can't grab it and test out the other stuff.

What do I do to make it draggable?

Code:
CreateFrame("ScrollFrame", "Critz_Scroll", Critz_Main, "FauxScrollFrameTemplate")
Critz_Scroll:SetSize(BUTTON_WIDTH, BUTTON_HEIGHT * NUM_BUTTONS)
Critz_Scroll:SetPoint("RIGHT", Critz_Main, "RIGHT", -BUTTON_HEIGHT * 2, 0)
Critz_Scroll:SetScript("OnVerticalScroll", function(self, offset)
	FauxScrollFrame_OnVerticalScroll(self, offset, BUTTON_HEIGHT, Scroll_Update)
end)
Critz_Scroll:Show()
__________________
Take it as it comes...
  Reply With Quote
06-21-13, 03:32 AM   #2
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Afaik the FauxScrollFrameTemplates is no actual scrolling frame. It just removes/appends rows based on the viewable area.

I suggest using the UIPanelScrollFrameTemplate.

Lua Code:
  1. --create a scrollframe on parent Critz_Main
  2.     local scrollFrame = CreateFrame("ScrollFrame", "$parentScrollFrame", Critz_Main, "UIPanelScrollFrameTemplate")
  3.     scrollFrame:SetPoint("TOPLEFT") --topleft point of Critz_Main
  4.     scrollFrame:SetPoint("BOTTOMRIGHT",-27,0) --bottomright point -27 of Critz_Main
  5.  
  6.     --add a scrollbar background
  7.     --[[
  8.     local tex = scrollFrame:CreateTexture(nil,"BACKGROUND",nil,-6)
  9.     tex:SetPoint("TOP",scrollFrame)
  10.     tex:SetPoint("RIGHT",scrollFrame,25.5,0)
  11.     tex:SetPoint("BOTTOM",scrollFrame)
  12.     tex:SetWidth(26)
  13.     tex:SetTexture("Interface\\PaperDollInfoFrame\\UI-Character-ScrollBar")
  14.     tex:SetTexCoord(0,0.45,0.1640625,1)
  15.     tex:SetAlpha(0.5)
  16.     ]]
  17.    
  18.     --the scrollchild
  19.     local scrollChild = CreateFrame("Frame",nil,scrollFrame)
  20.     local w,h = scrollFrame:GetSize()
  21.     scrollChild:SetSize(w,h)
  22.     scrollFrame:SetScrollChild(scrollChild)
  23.  
  24.     --put as many buttons/frames into the scrollchild as you like
  25.     local button = CreateFrame("Button", "MyShinyButton1", scrollChild, "UIPanelButtonTemplate")
  26.     button.text = _G[button:GetName().."Text"]
  27.     button.text:SetText("Hello World")
  28.     button:SetWidth(button.text:GetStringWidth()+20)
  29.     button:SetHeight(button.text:GetStringHeight()+12)
  30.     button:SetPoint("TOPLEFT",0,0)
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)

Last edited by zork : 06-21-13 at 03:45 AM.
  Reply With Quote
06-21-13, 07:29 AM   #3
Ledii
A Deviate Faerie Dragon
 
Ledii's Avatar
Join Date: Apr 2013
Posts: 10
Originally Posted by zork View Post
Afaik the FauxScrollFrameTemplates is no actual scrolling frame. It just removes/appends rows based on the viewable area.

I suggest using the UIPanelScrollFrameTemplate.
[/highlight]
Ah, why does it display a scrollbar if it isn't supposed to handle it?

Also, I find it very hard to learn what all the code for wow addons actually does, because there are very poor documentation on which calls are made and how everything connect together.

I would like to connect what I got for now to a scroller so that I can start testing as soon as possible,
will the scroller method you reccomended to that or would that be building it from scratch again? Tutorials sure don't help at all. Only debug info will do what I need sadly (which ofthen take ages).
__________________
Take it as it comes...
  Reply With Quote
06-21-13, 03:25 PM   #4
Torhal
A Pyroguard Emberseer
 
Torhal's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2008
Posts: 1,196
Originally Posted by Ledii View Post
Ah, why does it display a scrollbar if it isn't supposed to handle it?
Because it's a Faux (From the Old French for false) ScrollFrame. It acts like a scrollframe, but what it's actually doing is replacing every line with what would be at the scrollbars offset.
__________________
Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Author of NPCScan and many other AddOns.
  Reply With Quote
06-23-13, 11:14 PM   #5
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi,
I also had a lot of difficulties trying to implement correctly a scrollbar some time ago and if you need some more inputs you can check this thread too:

http://www.wowinterface.com/forums/s...ad.php?t=45810
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Need help with a Scrollbar!


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