WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   Lua/XML Help (https://www.wowinterface.com/forums/forumdisplay.php?f=16)
-   -   FauxScrollFrame in pure LUA problem (https://www.wowinterface.com/forums/showthread.php?t=58434)

Zax 12-04-20 10:08 AM

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:
Quote:

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.

Xrystal 12-04-20 10:25 AM

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.

Fizzlemizz 12-04-20 10:27 AM

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)


Zax 12-04-20 10:36 AM

OK, I understand.
Quote:

Originally Posted by Xrystal (Post 337788)
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?:confused:

Xrystal 12-04-20 10:39 AM

Quote:

Originally Posted by Zax (Post 337790)
OK, I understand.
Any clue about how to do that?:confused:

See FizzleMizz's response.

Zax 12-04-20 10:42 AM

Oops !

Thank you very much :)

Zax 12-05-20 07:45 AM

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)

Zax 12-05-20 08:28 AM

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...


All times are GMT -6. The time now is 11:47 AM.

vBulletin © 2021, Jelsoft Enterprises Ltd
© 2004 - 2020 MMOUI