Thread Tools Display Modes
11/08/15, 06:48 AM   #1
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
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.
  Reply With Quote
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.
  Reply With Quote
11/08/15, 03:25 PM   #3
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by merlight View Post
I
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'm guessing I must be missing something, but since your not inheriting, there is a lot of stuff missing isn't there? I see no scrollbar, nothing gets initialized (ZO_Scroll_Initialize) (even your tbugTabWindow1 has no .scroll or .scrollbar) I see no handlers to: handle extents changing, OnValueChanged, OnMouseWheel, no btns to move the scroll, exc... I understand you want it horizontal but I see no code to handle anything or maybe your just in the process of building it yourself? What did you expect it to do? Or better yet what are you trying to get it to do?


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.
  Reply With Quote
11/08/15, 03:55 PM   #4
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
Originally Posted by circonian View Post
I'm guessing I must be missing something, but since your not inheriting, there is a lot of stuff missing isn't there?
Yes, it's only purpose so far has been clipping the tab labels so they don't overflow out of the window if you open too many. Scrolling behaviour is what I've been struggling with this weekend. It appears that making a container with resizeToFitDescendents="true" the only child of the scroll, and putting everything in the container is the way to go. E.g. ANIMATION_SCROLL then works on the scroll control.

SetScrollBounding is still a mystery to me, but luckily scrolling works without touching that

Originally Posted by circonian View Post
As Wandamey said, I would look at zo_horizontalscrolllist.lua & the clothier crafting station code: smithingcreation_shared.xml & smithing_common.xml.
ZO_HorizontalScrollList is of no use here. It's written for a fixed number of items of equal width.
  Reply With Quote
11/08/15, 04:01 PM   #5
Wandamey
Guest
Posts: n/a
Originally Posted by merlight View Post
ZO_HorizontalScrollList is of no use here. It's written for a fixed number of items of equal width.
and you can't resize your controls depending on the longer one and reinitialize your scrolllist depending on the situation?

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.
  Reply With Quote
11/08/15, 08:05 PM   #6
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by merlight View Post
ZO_HorizontalScrollList is of no use here. It's written for a fixed number of items of equal width.
Nah, you can do it:




XML:
Warning: Spoiler


LUA:
Warning: Spoiler



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:
  1. -- add:
  2. local LEFT_PADDING = 50
  3.  
  4. function patternList:SetDefaultEntryAnchor(control, offsetX)
  5.     --control:SetAnchor(CENTER, self.control, CENTER, offsetX)
  6.     control:SetAnchor(LEFT, self.control, LEFT, offsetX + LEFT_PADDING)
  7. end

Last edited by circonian : 11/09/15 at 05:30 PM.
  Reply With Quote
11/10/15, 06:08 AM   #7
merlight
AddOn Author - Click to view addons
Join Date: Jul 2014
Posts: 671
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.
  Reply With Quote
11/10/15, 02:17 PM   #8
circonian
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 613
Originally Posted by merlight View Post
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.
You could still select items by clicking them this way too. You don't even have to handle the clicks, just make the slotTemplate mouseEnabled & the rest is handled for you.

xml Code:
  1. <Control name="HorizontalScroll_HList_SlotTemplate" virtual="true" mouseEnabled="true">



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.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » Need some help with understanding <Scroll> control


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