ESOUI

ESOUI (https://www.esoui.com/forums/index.php)
-   General Authoring Discussion (https://www.esoui.com/forums/forumdisplay.php?f=174)
-   -   Label with scrolling? (https://www.esoui.com/forums/showthread.php?t=7890)

Phuein 06/23/18 01:52 PM

Label with scrolling?
 
I have a ZO_ScrollContainer holding both a ZO_DefaultEditMultiLineForBackdrop and a CT_LABEL. When the Editbox is overflowing, I can scroll down. But when the Label is overflowing, I can see "..." at the bottom-left of it, and there's no scrolling.

I tried changing things around in all kinds of ways, but couldn't get any results. Couldn't find a simple example or virtual in the code, either. Any advice?

Code:

ScrollContainer = WINDOW_MANAGER:CreateControlFromVirtual("Somename_ScrollContainer", MainWindow, "ZO_ScrollContainer")
ScrollContainer.scrollChild = ScrollContainer:GetNamedChild("ScrollChild")               
ScrollContainer:SetAnchorFill(ItsBackdrop)
ScrollContainer:SetDrawLayer(0)       
ScrollContainer:SetDrawLevel(2)
ScrollContainer:SetDrawTier(0)
---------------------------------------------------------------------------------------------------       
Editbox = WINDOW_MANAGER:CreateControlFromVirtual("Somename_Contents", ScrollContainer, "ZO_DefaultEditMultiLineForBackdrop")       
Editbox:SetDrawLayer(0)
Editbox:SetDrawLevel(3)
Editbox:SetDrawTier(1)       
Editbox:SetMultiLine(true)
---------------------------------------------------------------------------------------------------       
Label = WINDOW_MANAGER:CreateControl("Somename_ContentsLabel", ScrollContainer, CT_LABEL)       
Label:SetAnchorFill(Editbox)
Label:SetDrawLayer(0)
Label:SetDrawLevel(3)
Label:SetDrawTier(1)
Label:SetMouseEnabled(true)


Phuein 06/27/18 09:00 PM

Seriously, nobody has any clue about this? Nobody made a label text block with scrolling?

Hydra9268 06/28/18 03:37 AM

Try :SetCanWrap(true)

Code:

Label = WINDOW_MANAGER:CreateControl("Somename_ContentsLabel", ScrollContainer, CT_LABEL)       
Label:SetAnchorFill(Editbox)
Label:SetDrawLayer(0)
Label:SetDrawLevel(3)
Label:SetDrawTier(1)
Label:SetMouseEnabled(true)
Label:SetCanWrap(true)


Phuein 06/28/18 03:02 PM

Quote:

Originally Posted by Hydra9268 (Post 35185)
Try :SetCanWrap(true)


Error. Doesn't exist. I can't find it anywhere in docs or code, either.

Baertram 06/28/18 03:43 PM

Correct me if I'm wrong but a label is not scrollable as it only holds one line of text as far as I know.
Or maybe you need to put the string with \n line break into the label control text like
labelCtrl:SetText("Line1\nLine2")


The possible functions for a label control can be found here:
http://wiki.esoui.com/Controls#LabelControl

Kyoma 06/28/18 04:27 PM

There is the code for the guild MotD which seems to use ZO_ScrollingSavingEditBox as a wrapper for this scrollable edit box / label combo. You can see the relevant code in
https://github.com/esoui/esoui/tree/...guild/keyboard

Check out guildhome_keyboard.xml and guildhome_keyboard.lua for an example on how to use it. Without more specific context to your code it can be hard to point out the exact problem for people that might want to help.

Phuein 06/28/18 09:58 PM

Done those suggestions. The MOTD example is very unfriendly, when translating to a somewhat different situation.

I've come up with my own solution which is working fine, although should have been handled on the dev' side of things. If it helps anyone in the future:

Code:

ScrollContainer = WINDOW_MANAGER:CreateControlFromVirtual("ScrollContainer", MainWindow, "ZO_ScrollContainer")
ScrollContainer.scrollChild = ScrollContainer:GetNamedChild("ScrollChild")
ScrollContainer:ClearAnchors()
ScrollContainer:SetAnchor(TOPLEFT, Backdrop, TOPLEFT, 0, 0)
ScrollContainer:SetAnchor(BOTTOMRIGHT, Backdrop, BOTTOMRIGHT, 0, -30) -- Extra space on bottom of page.

...

ContentsLabel = WINDOW_MANAGER:CreateControl("ContentsLabel", ScrollContainer.scrollChild, CT_LABEL)       
ContentsLabel:SetAnchor(TOPLEFT, ScrollContainer.scrollChild, TOPLEFT, 6, 5) -- Matches Editbox.
ContentsLabel:SetWidth(ScrollContainer:GetWidth()-20)

The Editbox that goes along with it uses this:

Code:

Contents = WINDOW_MANAGER:CreateControlFromVirtual("Contents", ScrollContainer, "ZO_DefaultEditMultiLineForBackdrop")
Contents:ClearAnchors()
Contents:SetAnchor(TOPLEFT, ScrollContainer, TOPLEFT, 6, 5)
Contents:SetHeight(ScrollContainer:GetHeight())
Contents:SetWidth(ScrollContainer:GetWidth()-20)



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

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2014 - 2022 MMOUI