• Wrapped DLabel stops displaying text
    4 replies, posted
Hello there, So I generated a 250 word text using lipsum.com and tried to put it in a DLabel and tried wrapping it, but the panel randomly stops after a number of words. But It's not a problem of size of the panel because the height is set to much higher than it will ever need to be. https://files.facepunch.com/forum/upload/113981/86595dbd-8293-4d0d-9c44-eaad0369c5b1/hl2_2018-11-15_04-02-41.png PS: The red is the DLabel background. This is the code for this menu: local text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam tincidunt nulla quis semper mollis. Mauris vitae leo bibendum, porttitor magna at, faucibus nunc. Aliquam vehicula lorem vel purus tincidunt, sit amet finibus neque dignissim. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Etiam convallis leo vitae dolor luctus dapibus. Suspendisse venenatis massa erat, at varius felis sagittis non. Duis porta enim sit amet pellentesque commodo. Nulla sapien nulla, cursus eu porttitor sed, ullamcorper at lacus. Aliquam eget dolor quis quam dapibus tincidunt.\n\nIn eu tristique leo. Morbi fringilla finibus iaculis. Cras vehicula a neque non porta. Donec nulla nulla, mattis in tempor luctus, eleifend id libero. Aenean posuere luctus porta. Proin luctus, nibh et interdum mollis, est urna condimentum odio, id sagittis mi diam sed ipsum. Nunc eget diam rhoncus, rhoncus massa et, eleifend nunc. Aliquam ultricies elit ante. Suspendisse consequat erat mi, a ultricies sapien ultrices vitae.\n\nSuspendisse potenti. Vestibulum aliquam fringilla diam eget vestibulum. Nunc nunc sem, accumsan id tortor at, auctor cursus est. Mauris consequat, nisi vel varius venenatis, ex metus ultricies tellus, sit amet sodales nisl elit ac tortor. Nam mi dolor, vehicula nec eleifend a, ullamcorper sed ligula. Etiam id ipsum porta tellus gravida finibus sed vitae ex. Nam aliquet aliquam nibh, a tempus sem pharetra id. Vivamus cursus urna a eros eleifend finibus. Cras aliquet fringilla nunc ut lacinia. Sed nec felis interdum, aliquet tellus vitae, commodo est. Aliquam hendrerit fringilla rhoncus. Maecenas malesuada quam ante, nec vulputate dolor."   local frame = vgui.Create("DFrame")   frame:SetSize(ScrW()-100,ScrH()-100)   frame:Center()   frame:MakePopup()   function frame:OnKeyCodePressed(key)     if key == KEY_F1 then       self:Remove()     end   end   frame.text = frame:Add("DLabel")   frame.text:SetText(text)   frame.text:SetFont("nutSmallFont")   frame.text:SetSize(frame:GetWide())   frame.text:SetPos(0,30)   function frame.text:Paint(w,h) draw.RoundedBox(4, 0, 0, w, h, Color(255,0,0,20)) end   frame.text:SetTall(frame:GetTall())   frame.text:SetWrap(true) But as you can see it stops short, do you guys know the issue? Cheers!
This might be purely coincidental but the length of text that does get printed seems to stop neatly at 1024 characters. I am not entirely sure if this number is significant but perhaps you've managed to reach the internal character-limit of DLabel, if there is one. I've honestly never seen DLabels be used like this on the grand scale of the screen, unless I am missing some obvious examples from other sources unheard of. I can't help but feel that there has to be a better way to print vast amounts of text without using DLabel necessarily, since I am unsure if DLabel was originally designed to be this big.
True, but the text that I need to display is user based and it will be used in game as a wiki sort of addon so the paragraphs will vary in size so the text panel needs to size up correctly without me having to set a width and height. That's why I defaulted to use the Dlabel, because it can do what I want in this application... Is there other ways of doing something like this, or will I have to limit the characters to 1024? Thanks mate!
You could just draw the text instead of using a DLabel. Take a look at markup.Parse.
Alright Thanks @beaner , I'll check it out. I also found this thread, they suggest other possibilities too. Thanks for the support!
Sorry, you need to Log In to post a reply to this thread.