I am running into this issue all the time, and I'm not sure how to combat it..
[CODE]
self.info = vgui.Create( "DPanel", self );
self.info:SetSize( 400, 500 );
self.info.desc = vgui.Create( "DLabel", self.info );
self.info.desc:SetPos( 4, 40 );
self.info.desc:SetAutoStretchVertical( true );
self.info.desc:SetText( [[Test Test Test Test Test Test Test Test Test Test Test Test
qweqweqweqwe
qwezd2123123123
]] );
self.info.desc:SizeToContents();
self.info.desc:SetColor( Color( 70, 70, 70 ) );
[/CODE]
[img]http://puu.sh/bpSQQ/9674b11e91.png[/img]
Try doing
[code]
self.info.desc:SetText("Test Test Test Test Test Test Test Test Test Test Test Test \nqweqweqweqwe \nqwezd2123123123")
[/code]
Or using an alternate font.
The issue with that is that this will be used for a DarkRP job description, eg. in the [[ string ]] format.
I managed to get around it by using the trebuchet24 font. Experiment with different fonts I guess.
Use a DTextEntry with Multiline.
[url]http://wiki.garrysmod.com/page/VGUI/Elements/DTextEntry[/url]
[lua]
local text = [[Test Test Test Test Test Test Test Test Test Test Test Test
qweqweqweqwe
qwezd2123123123
sada
sda
sda
sd
asd
as
da
sd
]]
local frame = vgui.Create( "DFrame" )
frame:SetSize( 400, 400 )
frame:Center()
frame:MakePopup()
local TextEntry = vgui.Create( "DTextEntry", frame )
TextEntry:SetPos( 25, 50 )
TextEntry:SetSize( 200, 250 )
TextEntry:SetMultiline(true)
TextEntry:SetEditable( false )
TextEntry:SetText( text )
[/lua]
[t]http://cloud-4.steampowered.com/ugc/532870790061837710/517E689586F8D3748E651B47D9DF0DCD1E479E2F/[/t]
[LUA]str:gsub( "\t", " " )[/LUA]
I'm horrible at string manipulation, am I using this right?
[code]
local wow = [[Test Test Test Test Test Test Test Test Test Test Test Test
qweqweqweqwe
qwezd2123123123
]]
string.gsub( wow, "\t", " " )
self.info.desc:SetText( wow );
[/code]
[IMG]http://puu.sh/bri5B/80a9dc4000.png[/IMG]
[editline]8th September 2014[/editline]
Well, the DTextEntry was an excellent work around, I got it to be seamless with a few changes.
[img]http://puu.sh/briVD/9c7855b040.png[/img]
For reference,
[code]
local desc = vgui.Create( "DTextEntry", self );
desc:SetPaintBorderEnabled( false );
desc:SetPaintBackgroundEnabled( false );
desc:SetDrawBorder( false );
desc:SetDrawBackground( false );
[/code]
Sorry, you need to Log In to post a reply to this thread.