• DLabel not fitting?
    4 replies, posted
Can't find anything about this on the wiki. Pretty straightforward. I'm making an addon for a server owner with a template he provided, and whenever I use the DLabel the message won't fit on it. It just goes "Would you..." cutting off the message with the three periods. Image: [url]http://imgur.com/uns468W[/url]
It would help if you showed us the code for this part :P
[QUOTE=Joshpai;50169987]It would help if you showed us the code for this part :P[/QUOTE] DUH! My bad. This should be what you need: [CODE] local mainFrame = vgui.Create("DFrame") mainFrame:SetSize(500, 200) mainFrame:SetPos(ScrW() / 2 - (500 / 2), ScrH() / 1.5) mainFrame:SetDraggable( false ) mainFrame:ShowCloseButton( true ) mainFrame:MakePopup() mainFrame:SetTitle("Pizza Delivery Man") mainFrame.Paint = function() draw.RoundedBox( 0, 0, 0, mainFrame:GetWide(), 25, Color(52, 73, 94) ) draw.RoundedBox( 0, 0, 25, mainFrame:GetWide(), mainFrame:GetTall() - 25, Color(226,226,226) ) end local panel = vgui.Create("DPanel", mainFrame) panel:SetSize(380, 100) panel:SetPos(115, 41) local dialogueTextLabel = vgui.Create("DLabel", panel) dialogueTextLabel:SetText("Would you like to deliver a pizza?") dialogueTextLabel:SetPos(10, 10) dialogueTextLabel:SetColor(Color(50, 50, 50))[/CODE]
You need to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/SizeToContents]Panel:SizeToContents[/url] after setting the Label:SetText(). Has to be after the text so it knows how big it needs to be. [CODE] local dialogueTextLabel = vgui.Create("DLabel", panel) dialogueTextLabel:SetText("Would you like to deliver a pizza?") dialogueTextLabel:SizeToContents() dialogueTextLabel:SetPos(10, 10) dialogueTextLabel:SetColor(Color(50, 50, 50)) [/CODE]
[QUOTE=Semajnad;50170106]You need to use [img]http://wiki.garrysmod.com/favicon.ico[/img] [url=http://wiki.garrysmod.com/page/Panel/SizeToContents]Panel:SizeToContents[/url] after setting the Label:SetText(). Has to be after the text so it knows how big it needs to be. [CODE] local dialogueTextLabel = vgui.Create("DLabel", panel) dialogueTextLabel:SetText("Would you like to deliver a pizza?") dialogueTextLabel:SizeToContents() dialogueTextLabel:SetPos(10, 10) dialogueTextLabel:SetColor(Color(50, 50, 50)) [/CODE][/QUOTE] Thank you!!!
Sorry, you need to Log In to post a reply to this thread.