I'm currently working on an ingame-menu for one of my addons, namely my oUF-layout.
I have a little problem with the FauxScrollFrame. I previously used this template in an XML-based menu, and everything works like a charm.
In the scroll-frame I had this code
xml Code:
<ScrollFrame name="$parentList" inherits="FauxScrollFrameTemplate">
<Anchors>
<Anchor point="TOPLEFT" relativeTo="$parent" relativePoint="TOPLEFT">
<Offset><AbsDimension x="5" y="-75" /></Offset>
</Anchor>
<Anchor point="BOTTOMRIGHT" relativeTo="$parent" relativePoint="BOTTOMLEFT">
<Offset><AbsDimension x="175" y="5" /></Offset>
</Anchor>
</Anchors>
<Scripts>
<OnVerticalScroll>
FauxScrollFrame_OnVerticalScroll(this, offset, 16, BuffologyMenuFunctions.TabFilter.AuraList_Update);
</OnVerticalScroll>
<OnShow> BuffologyMenuFunctions.TabFilter.AuraList_Update(); </OnShow>
</Scripts>
</ScrollFrame>
As I said, works like a charm.
But since I don't want to create an XML-file just for a scroll-frame, I planned on creating the menu for my oUF-layout in Lua:
lua Code:
local ScrollFrame = CreateFrame('ScrollFrame', 'oUF_PredatorSimplePositionScrollFrame', frame, 'FauxScrollFrameTemplate')
ScrollFrame:SetPoint('TOPLEFT', 15, -75)
ScrollFrame:SetPoint('BOTTOMRIGHT', -40, 15)
ScrollFrame:SetScript('OnVerticalScroll', function()
FauxScrollFrame_OnVerticalScroll(this, offset, 3, menu.UpdatePositionScrollFrame)
end)
ScrollFrame:SetScript('OnShow', menu.UpdatePositionScrollFrame)
It throws an error on scrolling, namely
Code:
Message: Interface\FrameXML\UIPanelTemplates.lua:238: Usage: oUF_PredatorSimplePositionScrollFrameScrollBar:SetValue(value)
Time: 08/19/10 19:20:57
Count: 4
Stack: [C]: in function `SetValue'
Interface\FrameXML\UIPanelTemplates.lua:238: in function `FauxScrollFrame_OnVerticalScroll'
Interface\AddOns\oUF_PredatorSimple\menu.lua:123: in function <Interface\AddOns\oUF_PredatorSimple\menu.lua:122>
[C]: in function `SetVerticalScroll'
[string "*:OnValueChanged"]:1: in function <[string "*:OnValueChanged"]:1>
[C]: in function `SetValue'
Interface\FrameXML\UIPanelTemplates.lua:163: in function `ScrollFrameTemplate_OnMouseWheel'
[string "*:OnMouseWheel"]:1: in function <[string "*:OnMouseWheel"]:1>
Locals: (*temporary) = oUF_PredatorSimplePositionScrollFrameScrollBar {
0 = <userdata>
}
(*temporary) = nil
I assume, 'offset' is not set. I just don't understand why not, because I mimic the XML-behaviour, at least I guess so.
Any hints how to fix this? Or at least, how can I fetch the offset while scrolling? It seems to happen automatically when creating this in XML, but not, when creating in Lua. I just have no idea why...