Garry's Mod Wiki

Panel:SetText

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.

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:

Page Links


Special Pages


Wikis

?

Render Time: 43ms

DB GetPage 4
Generate Html 15
SaveChanges (1) 9
Render Body 0
Render Sidebar 12