As horrible as it may sound, I used a DLabel to draw text in boxes all the time. It was messy due to the constant /n's. Although it works, I'm sure theres a better and cleaner way.
All-in-all I want to draw text that's parented to a panel, and disappears when the panel closes.
There's a few things you can do.
Usually when I'm trying to draw text to a panel I'll override its Paint() function and then draw the text in manually using [URL="http://wiki.garrysmod.com/page/draw/SimpleText"]draw.SimpleText()[/URL], [URL="http://wiki.garrysmod.com/page/draw/Text"]draw.Text()[/URL], or [URL="http://wiki.garrysmod.com/page/surface/DrawText"]surface.DrawText()[/URL].
Yeah, the way I usually do it is with [URL="http://wiki.garrysmod.com/page/surface/DrawText"]surface.DrawText[/URL] as said above, since [URL="http://wiki.garrysmod.com/page/draw/SimpleText"]SimpleText[/URL] and [URL="http://wiki.garrysmod.com/page/draw/Text"]Text[/URL] [URL="https://github.com/garrynewman/garrysmod/blob/master/garrysmod/lua/includes/modules/draw.lua#L95"]use it internally[/URL], so I consider it to be a bit faster, even though it's not really.
For what you're doing, I'd probably use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/draw/DrawText]draw.DrawText[/url], because it supports newlines and tabs like you want. It also supports alignment, which is quite useful.
Sorry, you need to Log In to post a reply to this thread.