Quantcast Label with scrolling? - ESOUI
Thread Tools Display Modes
06/23/18, 01:52 PM   #1
Phuein
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 47
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)
  Reply With Quote
06/27/18, 09:00 PM   #2
Phuein
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 47
Seriously, nobody has any clue about this? Nobody made a label text block with scrolling?
  Reply With Quote
06/28/18, 03:37 AM   #3
Hydra9268
AddOn Author - Click to view addons
Join Date: May 2018
Posts: 10
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)

Last edited by Hydra9268 : 06/28/18 at 03:50 AM.
  Reply With Quote
06/28/18, 03:02 PM   #4
Phuein
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 47
Originally Posted by Hydra9268 View Post
Try :SetCanWrap(true)

Error. Doesn't exist. I can't find it anywhere in docs or code, either.
  Reply With Quote
06/28/18, 03:43 PM   #5
Baertram
 
Baertram's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 1,768
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
  Reply With Quote
06/28/18, 04:27 PM   #6
Kyoma
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 70
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.
  Reply With Quote
06/28/18, 09:58 PM   #7
Phuein
AddOn Author - Click to view addons
Join Date: Mar 2018
Posts: 47
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)
  Reply With Quote

ESOUI » Developer Discussions » General Authoring Discussion » Label with scrolling?

Thread Tools
Display Modes

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