Thread Tools Display Modes
12-04-20, 10:08 AM   #1
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
FauxScrollFrame in pure LUA problem

Hello,

Sorry if it has already been asked but I encounter a problem with FauxScrollFrame.
In the past, I used this kind of frame with XML without problem, but now I'm trying in pure LUA.
When I click on the arrows to scroll, I have this error:
Interface\SharedXML\SecureUIPanelTemplates.lua:329: Usage: Cmdli_frameHisto_scrollScrollBar:SetValue(value, [treatAsMouseEvent])...
The problem seems to come from offset in:
Code:
frameScroll:SetScript("OnVerticalScroll", function () 
	FauxScrollFrame_OnVerticalScroll(frameScroll, offset, 16, Cmdli.scrollerUpdate)  -- "Cmdli" is my current namespace
end)
In previous XML version, offset wasn't defined and it worked (don't know why), and now I don't know what value offset should have.

Thank you for your help.
  Reply With Quote
12-04-20, 10:25 AM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
The problem is that your OnVerticalScroll function isn't storing its parameters in a value.

In Xml it is automatically stored in the variable used but in Lua you have to store it yourself

OnVerticalScroll(self, offset) - Run when the scroll frame's vertical scroll position changes.
__________________
  Reply With Quote
12-04-20, 10:27 AM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
offset is a parameter passed to the script which is then passed to your function as the second parameter.

Code:
frameScroll:SetScript("OnVerticalScroll", function (self, offset) 
	FauxScrollFrame_OnVerticalScroll(frameScroll, offset, 16, Cmdli.scrollerUpdate)  -- "Cmdli" is my vcurrent namespace
end)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
12-04-20, 10:36 AM   #4
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
OK, I understand.
Originally Posted by Xrystal View Post
In Xml it is automatically stored in the variable used but in Lua you have to store it yourself.
Any clue about how to do that?
  Reply With Quote
12-04-20, 10:39 AM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Originally Posted by Zax View Post
OK, I understand.
Any clue about how to do that?
See FizzleMizz's response.
__________________
  Reply With Quote
12-04-20, 10:42 AM   #6
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
Oops !

Thank you very much
  Reply With Quote
12-05-20, 07:45 AM   #7
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
My scroll frame works fine, but I have another question: apparently, FauxScrollFrame_Update has an option to not always show scroll buttons.
I'm unable to make option alwaysShowScrollBar work: scroll buttons are always visible, even if the scroll frame contains one line.

Code:
 -- Function to handle the update of manually calculated
    scrollframes.  Used mostly for listings with an indeterminate
    number of items
 function FauxScrollFrame_Update(frame, numItems, numToDisplay,
    valueStep, button, smallWidth, bigWidth, highlightFrame,
    smallHighlightWidth, bigHighlightWidth, alwaysShowScrollBar )
In https://github.com/tomrus88/Blizzard...goriesList.lua, I see:
Blizzard_AuctionHouseCategoriesList.lua
Code:
FauxScrollFrame_Update(categoriesList.ScrollFrame, #EXPANDED_FILTERS, NUM_FILTERS_TO_DISPLAY, BROWSE_FILTER_HEIGHT, nil, nil, nil, nil, nil, nil, alwaysShowScrollBar)
  Reply With Quote
12-05-20, 08:28 AM   #8
Zax
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Aug 2006
Posts: 147
OK, after several tests, in order to make my scroll frame work, whenever the number of lines in data is lower or greater then the number of "displayable" lines, I have to pass true as last parameter:
Code:
FauxScrollFrame_Update(myScrollerFrame, numDataLines, maxVisibleLines, lineHeight, nil, nil, nil, nil, nil, nil, true)
Don't ask me why...
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » FauxScrollFrame in pure LUA problem

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