DLabel not fitting?

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:
Imgur

It would help if you showed us the code for this part :stuck_out_tongue:

DUH! My bad. This should be what you need:



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

You need to use

Panel:SizeToContents after setting the Label:SetText(). Has to be after the text so it knows how big it needs to be.



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


Thank you!!!