ZO_ScrollList's individual rowHeight
Hey,
Is it possible to change the rowHeight individually for every data you push into it? For example: Code:
local LibScroll = LibStub:GetLibrary ( "LibScroll" ) Now, if you left click the one control that expands to a second row and you right click it you can see that the value of _list.controlHeight changed to be the same than _control:GetHeight ( ) but nothing happens. And the reason why nothing happens is it changes the rowHeight but only for the next items you're going to place in the ZO_ScrollList. So if you click the middle mouse now it pushes three new texts replacing the previous ones. And those have the new rowHeight you set by left clicking one of the contents. So how I'm able to change the rowHeight as I'm placing new data in the ZO_ScrollList? |
You can register different data types for different heights, but in the end you need to stick to predefined row heights. Otherwise the scroll list can't calculate the overall height of the content and won't be able to render correctly.
|
Quote:
But I don't really understand... So I can only have one height for all the data items I have in my ZO_ScrollList? That simply doesn't make any sense. :confused: And I don't really need any different data types for different heights. I want to display a text and if it's too long and it's pushed to a second (or third, fourth, ...) row, the item's height (contentHeight) would change so that it doesn't overlap with other texts inside the ZO_ScrollData. |
A scroll list only renders rows that are actually visible on the screen. The other rows do not actually exist while out of view. In order to correctly show the scroll bar and position the elements, the scroll list somehow needs to know how much height all rows will take, but for the non-existing rows it can't call GetHeight, so it uses a predefined height based on the datatype instead.
There are a few possibilities to get dynamic heights to work, but they are rather complicated. Your easiest option is to make sure the text doesn't break into a new row. Either you make your list wide enough, or you cut the text off when it is too long (TextWrapMode) and show a tooltip on mouseover. |
Quote:
Of course I could simple make the rowHeight three times as large as it is now but when most of the data is 1-2 rows it would look kinda silly because of the uneven padding in between. I've worked with Javascript, C++, XML and QML before so it's not all new. I just don't really understand why LUA doesn't automatically determine the height of the ZO_ScrollList element and it uses a specific height in all of them. EDIT I've also tried to research if I could be able to place an empty XML object which has a height defined by the text and it could potentially expand the height, but that's probably just other scenario of the same problem I'm having now; I'm not able to manually define the rowHeight when pushing or updating items in ZO_ScrollList. |
Quote:
|
Quote:
You would need to implement your own function to calculate the overall height in order to do what you want. EDIT: And as Dolgubon mentions, the ZO_ScrollList is not part of Lua itself. It's a component provided by ZOS. |
I do know what you said there, it was like more of a general wondering than a question. And yes, ZO_ScrollList is made by ZOS which is quite clear but LUA is still the code language and it doesn't understand (which should've been covered by ZOS itself, in my opinion).
But anyways, thanks for the replies. Will need to take a closer look at it when I have some more time. I have another question related to the behavior of ZO_ScrollList; I couldn't find any kind of information of it so that's why I'm asking. Are you able to change the direction of scrolling from up-down to down-up? Thanks! (Didn't feel like starting a new topic because it's sort of related to this problem...) |
ZO_ScrollList is not a wholesome library and ZOS is not a charity. It is merely a tool made for a specific usecase by a company trying to make the most out of their time. It doesn't do anything besides that. If you need extra features, you will need to implement them yourself. That's how it is with almost anything related to ESO addons. ;)
Do you mean the starting position of the scroll list? If so, you could use Lua Code:
|
Quote:
That ZO_Scroll_ScrollAbsoluteInstantly function, though. I mean that usually ZO_ScrollList works the way that new elements are pushed above the older ones. Like this:
But how I would like to make it is like this:
|
Are you looking to change the sort order of the scroll list? That's determined by the functions some fields on the scroll list that you can change.
While you are scrolling, the UI elements go like this: ____ control1 control2 control3 ------ and then if you scroll down: ------ control2 control3 control1 ------ and control1 has different 'stuff' in it, taking the value next in the (sorted or unsorted) list. |
You could do that with a ZO_SortFilterList which is a wrapper around the ZO_ScrollList which allows to filter and sort elements.
|
No, I don't mean sorting the results. I'm not sure how to explain it so I did an example with HTML and javascript:
The left one represents what ZO_ScrollList (and any other list) usually looks like, right? But I want the list to be attached to the bottom of the list and growing upwards like on the image on the right. |
So you just mean make the list grow up rather than down.
|
Don't think that is possible. You would need to change how elements are anchored, which is not easily done.
|
You could try hooking the SetAnchor function for each scrollListRow. e.g.
local original = row.SetAnchor row.setAnchor = function(self, ... AnchorPositionTop, ....) original(self, ... AnchorPositionBottom,...) end Not sure of names, and this might not actually do what you want, you'd likely need to play around with it a bit. |
Okay, thanks for the replies. Will try what Dolgubon said and if I can't find a way around it I'll just leave it as it is. But thank you very much for the help. :)
|
All times are GMT -6. The time now is 04:59 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI