Derma DLabel Issues

I am running into this issue all the time, and I’m not sure how to combat it…



    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 ) );


http://puu.sh/bpSQQ/9674b11e91.png

Try doing



self.info.desc:SetText("Test Test Test Test Test Test Test Test Test Test Test Test 
qweqweqweqwe 
qwezd2123123123")


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.

[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]

http://cloud-4.steampowered.com/ugc/532870790061837710/517E689586F8D3748E651B47D9DF0DCD1E479E2F/

[LUA]str:gsub( " ", " " )[/LUA]

I’m horrible at string manipulation, am I using this right?



local wow = [[Test Test Test Test Test Test Test Test Test Test Test Test 
        qweqweqweqwe
        qwezd2123123123
        ]]
    string.gsub( wow, "	", "   " )
    self.info.desc:SetText( wow );


http://puu.sh/bri5B/80a9dc4000.png

[editline]8th September 2014[/editline]

Well, the DTextEntry was an excellent work around, I got it to be seamless with a few changes.

http://puu.sh/briVD/9c7855b040.png

For reference,



local desc = vgui.Create( "DTextEntry", self );
desc:SetPaintBorderEnabled( false );
desc:SetPaintBackgroundEnabled( false );

desc:SetDrawBorder( false );
desc:SetDrawBackground( false );