Garry's Mod Wiki


  Panel:SetText( string text )


Sets the text value of a panel object containing text, such as a Label, TextEntry or RichText and their derivatives, such as DLabel, DTextEntry or DButton.

When used on a Label or its derivatives ( DLabel and DButton ), it will automatically call Panel:InvalidateLayout, meaning that you should avoid running this function every frame on these panels to avoid unnecessary performance loss.


1 string text
The text value to set.


Creates a RichText element and sets the text to a localized string; the default VAC rejection message.

-- Window frame for the RichText TextFrame = vgui.Create("DFrame") TextFrame:SetSize(250, 150) TextFrame:Center() TextFrame:SetTitle("#VAC_ConnectionRefusedTitle") -- Results in "Connection Refused - VAC" -- RichText panel local richtext = vgui.Create("RichText", TextFrame) richtext:Dock(FILL) -- Set the text to the message you get when VAC banned richtext:SetText("#VAC_ConnectionRefusedDetail")