Thread Tools Display Modes
05-21-16, 09:06 AM   #1
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Scroll frames, positioning and horizontal scroll

In the following snippet the slider works fine on live, does nothing in beta.
For some reason, :SetHorizontalScroll and :SetPoint methods don't work together.

Lua Code:
  1. local Frame = CreateFrame('Frame', nil, UIParent)
  2. Frame:SetPoint('CENTER')
  3. Frame:SetSize(300, 40)
  4.  
  5. local Background = Frame:CreateTexture(nil, 'BORDER')
  6. Background:SetAllPoints()
  7.  
  8. if(select(4, GetBuildInfo()) >= 70000) then
  9.     Background:SetColorTexture(1/3, 1/3, 1/3)
  10. else
  11.     Background:SetTexture(1/3, 1/3, 1/3)
  12. end
  13.  
  14. local ScrollFrame = CreateFrame('ScrollFrame', nil, Frame)
  15. ScrollFrame:SetPoint('LEFT')
  16. ScrollFrame:SetSize(300, 40)
  17.  
  18. local ScrollChild = CreateFrame('Frame')
  19. ScrollChild:SetSize(ScrollFrame:GetSize())
  20. ScrollFrame:SetScrollChild(ScrollChild)
  21.  
  22. local Portrait = CreateFrame('PlayerModel', nil, ScrollChild)
  23. Portrait:SetAllPoints()
  24. Portrait:SetPortraitZoom(1)
  25. Portrait:RegisterEvent('UNIT_MODEL_CHANGED')
  26. Portrait:SetScript('OnEvent', function()
  27.     Portrait:SetUnit('player')
  28. end)
  29.  
  30. local Slider = CreateFrame('Slider', nil, UIParent, 'OptionsSliderTemplate')
  31. Slider:SetPoint('TOP', Frame, 'BOTTOM', 0, -30)
  32. Slider:SetMinMaxValues(0, 300)
  33. Slider:SetValue(300)
  34.  
  35. Slider:SetScript('OnValueChanged', function(self, value)
  36.     local reverse = 300 - value
  37.  
  38.     -- the following two lines don't work together on the beta, works fine on live
  39.     -- seperately they work just fine though, and there are no errors
  40.     ScrollFrame:SetPoint('LEFT', -reverse, 0)
  41.     ScrollFrame:SetHorizontalScroll(-reverse)
  42. end)

If you print :GetHorizontalScroll and :GetPoint after setting them it shows that both changed, it just doesn't update properly on the beta.

Last edited by p3lim : 05-21-16 at 09:19 AM.
 
 

WoWInterface » Site Forums » Archived Beta Forums » Legion Beta archived threads » Scroll frames, positioning and horizontal scroll

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