Garry's Mod Wiki

Garry's Mod Wiki

  Panel:SetText( string text )

Description

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.
Label & its derivatives has hard length limit, maximum 1023 ascii characters.

Arguments

1 string text
The text value to set.

Example

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")
Output:

This site is a community mirror of the official Garry's Mod wiki.. This site is not maintained by Facepunch Studios.

Page content is automatically updated four times a day. Edits and history are not available.

Last Parsed: Loading...