Garry's Mod Wiki

Panel:SetWrap

Panel:SetWrap( boolean wrap )

Description

Sets whether text wrapping should be enabled or disabled on Label and DLabel panels. Use DLabel:SetAutoStretchVertical to automatically correct vertical size; Panel:SizeToContents will not set the correct height.

Arguments

1 boolean wrap
True to enable text wrapping, false otherwise.

Example

Creates two labels in a panel and sets the text wrapping to false and true respectively.

-- Background panel BGPanel = vgui.Create("DPanel") BGPanel:SetSize(300, 130) BGPanel:Center() BGPanel:SetBackgroundColor(Color(0, 0, 0)) -- Label with no text wrapping local lbl_nowrap = vgui.Create("DLabel", BGPanel) lbl_nowrap:SetPos(10, 10) lbl_nowrap:SetSize(280, 50) lbl_nowrap:SetFont("GModNotify") lbl_nowrap:SetText("This is a label that has text wrapping disabled.") lbl_nowrap:SetWrap(false) -- Label with text wrapping local lbl_wrap = vgui.Create("DLabel", BGPanel) lbl_wrap:SetPos(10, 70) lbl_wrap:SetSize(280, 50) lbl_wrap:SetFont("GModNotify") lbl_wrap:SetText("This is a label that has text wrapping enabled.") lbl_wrap:SetWrap(true)
Output:

Page Links


Special Pages


Wikis

?

Render Time: 33ms

DB GetPage 4
Generate Html 6
SaveChanges (1) 8
Render Body 0
Render Sidebar 12