11/08/15, 06:48 AM | #1 |
|
Need some help with understanding <Scroll> control
I have a plain <Scroll> control (XML source). No inherits="ZO_Scroll", since it only supports vertical scrolling and I want horizontal. No scrollbar.
Here's a picture of two Torchbug windows inspecting tbugTabWindow1Tabs: tbugTabWindow1Tabs is the scroll control in the yellow box. It has 14 children: ActiveBg provides the dark background for the active tab "6", and children 2..14 are tab labels that were added dynamically -- intentionally too many to fit, you can see "_mouseSomething" is clipped on the right. What I don't understand is that both extents.horizontal and extents.vertical are 0 (these are values returned by GetScrollExtents). And when I do /script tbugTabWindow1Tabs:SetHorizontalScroll(10), nothing happens. Offsets remain at 0. I tried playing with SetScrollBounding, and when I set it to SCROLL_BOUNDING_UNBOUND and then SetHorizontalScroll(10), what happens is this: ActiveBg (the first child) is reanchored to the parent with offsetX=-10 and offsetY=-0 (not kidding, negative zero). All other children stay where they are. Looking at how ZO_ScrollContainer is implemented, I'm beginning to think that the scroll control determines its inner extents solely from its first child, and that scrolling is actually implemented by shifting that child's anchor in the opposite direction. Also does anyone know what different ScrollBounding values do? So far I've figured that UNBOUND allows you to SetVertical/HorizontalScroll beyond what GetScrollExtents returns. All other values (BOUND, CONTAINED, DEFAULT) seem to prevent that. |
11/08/15, 11:33 AM | #2 | |
Wandamey
Guest
Posts: n/a
|
not sure if I understand one word of what you said, but i couldn't find this in your post / file :
ZO_HorizontalScrollList thats what is used at the crafting station. could be helpful. |
|
Wandamey |
11/08/15, 03:25 PM | #3 | |
|
This probably isn't to helpful, I've never used this, but heres what I noticed using SetHorizontalScroll with: SCROLL_BOUNDING_CONTAINED -- seems to change the extents & offset SCROLL_BOUNDING_UNBOUND -- changes the offset only SCROLL_BOUNDING_BOUND -- changes neither SCROLL_BOUNDING_DEFAULT -- changes offset only Changing the bounding allows changing the extent & offsets, but even then nothing happens. You said your 1st control reanchored & moved when you called SetHorizontalScroll() after changing the bounds? It didn't for me. Since I see no code for SetHorizontalScroll, I'm assuming it just sets a value but doesn't actually do anything else and I see no handlers to do anything even if those values change. As Wandamey said, I would look at zo_horizontalscrolllist.lua & the clothier crafting station code: smithingcreation_shared.xml & smithing_common.xml. |
|
11/08/15, 03:55 PM | #4 | |
|
SetScrollBounding is still a mystery to me, but luckily scrolling works without touching that ZO_HorizontalScrollList is of no use here. It's written for a fixed number of items of equal width. |
|
11/08/15, 04:01 PM | #5 | ||
Wandamey
Guest
Posts: n/a
|
Edit : actually that's what the smithing station does already, the table of listed items changes at each station/filter change for the corresponding table. for the size of the elements idk though. I can't deny that they were all square. I remember having emptied my crafting lists by accident while I was testing the smithing stations... shouldn't be too hard to reinit. Last edited by Wandamey : 11/08/15 at 04:08 PM. |
||
Wandamey |
11/08/15, 08:05 PM | #6 | |
|
XML:
Warning: Spoiler
xml Code:
LUA:
Warning: Spoiler
Lua Code:
I didn't do this in the screenshots, didn't think of it until afterwords, but if you wanted (you probably would) you can change the DefaultEntryAnchor so that the "selected" control gets aligned left instead of center. Lua Code:
Last edited by circonian : 11/09/15 at 05:30 PM. |
|
11/10/15, 06:08 AM | #7 |
|
Interesting, I didn't know ZO_HorizontalScrollList can handle variable width items. And I didn't even think about item-wise scrolling (select next/previous). I only did area scrolling and you have to click to select another item. But I'm starting to like the idea of scrolling selection.
|
11/10/15, 02:17 PM | #8 | |
|
xml Code:
You can also scroll with the mouse wheel or click/drag the bar to scroll through it, its all handled for you. If you wanted you could even hide the big Left/Right buttons. |
|
05/10/16, 04:24 PM | #9 |
|
Heyho,
I'm currently having trouble setting up a scrollable area and stumbled upon this thread as i did some research with google. I'd like to set up a scrollable area from scratch, that means not using any inherited or predefined control/code written by zenimax. Sadly I have no clue how the scroll control works. I found a cheap and dirty workaround, but it's not really working well for it throws some lua errors: Here is what i did: 1. defined a scrollbar using a slider-control. 2. defined a control of type "CT_SCROLL" (name="ScrollChild") and added a regular CT_CONTROL (name="ScrollingContainer") to it. 3. Using the slider's "OnValueChanged" - event i simply modify the "ScrollingContainer"'s anchor-offset by clearing it's anchors and adding a new one with the new y-offset. Because ScrollingContainer is a child-element of the CT_SCROLL every content displayed "outside" the CT_SCOLL wont be displayed for CT_CONTROL seems to behave like an HTML div-container with overflow:hidden. This results in the desired behaviour but also throws the "too many anchors processed" lua error - not to mention the low performance. I'd really like how to implement scrolling areas in a proper way, could anybody help me? Here's the code: Lua Code:
Scrolled down one step (1 step = height of one row of icons, padding included): Cheers, Letho Last edited by Letho : 05/10/16 at 05:08 PM. Reason: adding code |
05/10/16, 06:11 PM | #10 | |
|
In your code above, you're creating as many icon controls as there are icons in your dataset. And each time you scroll, all of them need to follow their anchor to the container; including those not currently visible. ZO_ScrollList, on the other hand, creates only enough row controls to fill the area; and reuses them as you scroll around. That means fewer controls overall, and fewer anchor updates when scrolling. |
|
05/11/16, 04:35 AM | #11 |
|
Hey merlight, thank you for your quick response! I was afraid that would be the case, the actual reason for me not to use the Z_ScrollList is I havent been able to get it running, nor understanding the whole code inside it's lua file :/
I don't even understand the principle behind it's mechanic, I mean the princible I use in my code is quite easy: move the child Elements of a control that hides all of its child element's overflow by modifying the child elements anchor-x/y-offsets^^ Could u / anybody explain how ZO_ScrollList implements the scrolling behaviour and what functions u need to set up a simple scrolling container? I've read through this thread and some others and could reproduce your problems with SetScrollBounding. At least I was finally able to "unlock" (= getting it to save values different from 0) the SetVerticalScroll() - function, but it did not change any displayed content. Another suspicion/fear I have is that ESOs controls are not meant to scroll areas that contain as many items as i want to be displayed :/ Within my implementation the "too many anchors processed" - error is even thrown if i reduce my dataset to 10 elements Last edited by Letho : 05/11/16 at 04:41 AM. |
05/11/16, 04:55 AM | #12 |
If you want to display stuff in a controll which is scrollable, just do :
Lua Code:
If you want to create a Scroll list (Aka : A list of data which is scrollable) XML A row : Lua Code:
The list itself : In the list we define the headers and the list. Here I used sortable headers (the ones with the little triangles to sort). ZO_SortHeader_Initialize is used to make an header with a name ZO_SortHeader_InitializeArrowHeader is used to make an header without Lua Code:
Then, in Lua : Lua Code:
-> Last edited by Ayantir : 05/11/16 at 05:18 AM. |
|
05/11/16, 05:14 AM | #13 |
|
Hi Ayantir, thx for your help! I'll just copy it to my notepad++ and try to understand and reproduce it! (I always have to see the actual result ingame in order to understand code^^)
|
05/11/16, 05:18 AM | #14 |
|
Ok, first question I have:
lua Code:
What control is "MyXMLControlContainerScrollChild"? Cheers |
05/11/16, 05:22 AM | #15 | |
Lua Code:
MyXMLControl.... Lua Code:
MyXMLControlContainer ... ScrollChild is added by inherits="ZO_ScrollContainer" so MyXMLControlContainerScrollChild is the control which will host all the data you want to be scrollable. (look at the pict I posted) |
||
05/11/16, 06:34 AM | #16 |
|
Hey, just wanted to thank u for your help! I'm currently eating myself through the code, modifying my containers to get some (visual) understanding of what each container does^^ I'm afraid I'm far away from understanding even the basics for I only know WoW Lua (not the xml widget api) and generic XHTML and I actually have no clue what the rules for ESOs XAML interface are. But your examples help a lot
I'm sure there will be more questions in the future, I'll just post them here if u dont mind, your help is much appreciated, very cool that places like this exist! |
05/11/16, 07:40 AM | #17 | |
|
Ok I finally managed setting up a working scroll container:
lua Code:
And the .lua file for adding one of the above mentioned icons to the scroll container: lua Code:
This code results in the icon texture being displayed, but no scroll bar and no background for the scrollcontainer. In this post (http://www.esoui.com/forums/showpost.php?p=10826) u stated that
Did i do something wrong or did Zenimax change that? How do i set up a scollbar and associate it or it's event handler OnValueChanged to the container? P.S.: I didn't get that ZO_ScrollContainer and ZO_ScrollList are two different things, that confused me Last edited by Letho : 05/11/16 at 10:58 AM. |
|
05/11/16, 12:54 PM | #18 | |
|
The simplest use of ZO_ScrollList I could quickly find is AbilityList. Here it's initialized with two row types, and here it's filled with data. All you need is a control created from the ZO_ScrollList template, either in XML or in Lua: Lua Code:
Another example is in LibAddonMenu. That usually happens when your anchors have circular dependency. Which includes a kind of chicken&egg problem when a container control has resizeToFitDescendents="true" and its children are trying to fill the parent. |
|
05/11/16, 01:01 PM | #19 |
|
I understand, would u advice not to use ZO_ScrollContainer but ZO_ScrollList instead? I find the container version far more simple :/
Can you describe how to set up a scrollbar for a ZO_ScrollContainer and how to use its scrolling event handler? Btw. are these controls and it's functions documented somewhere? Getting help is always good, but i dont want you to get the impression im just asking here becuz im too lazy to read a documentation I just did research for the last two days and i'm really getting more and more desperate, especially if i consider my addon is nearly finished with the scroll container problem being the only thing standing in my way ;D |
05/11/16, 02:23 PM | #20 | ||
|
- ZO_ScrollContainer for UI widgets -- a number of controls, often of different types, shapes and sizes; each with a specific purpose -- a good example is LibAddonMenu's panel control - ZO_ScrollList for lists of similar items -- like inventory; here the controls (rows) are not special, any of them can display any data item. You wouldn't want the guild bank UI to actually contain 500 rows. ZO_ScrollList does all the work required to create the illusion of there being 500 rows, while it only constructs as many row controls as are simultaneously visible. You have N icons, M per row. So you'll add ceil(N/M) data rows to the list (simple tables containing up to M texture paths), and your row control setup function will set the textures on icon controls in the row.
|
||
ESOUI » Developer Discussions » Lua/XML Help » Need some help with understanding <Scroll> control |
«
Previous Thread
|
Next Thread
»
|
Thread Tools | |
Display Modes | |
|
|