Garry's Mod Wiki

DLabelEditable

Description

An editable DLabel, double click on it to edit.

This is used in the spawnmenu spawnlist headers.

View source

Parent

Derives methods, etc not listed on this page from DLabel.

Methods

boolean DLabelEditable:GetAutoStretch()
Returns whether the editable label will stretch to the text entered or not.
boolean DLabelEditable:IsEditing()
Returns whether this DLabelEditable is being edited or not. (i. e. has focus)
string DLabelEditable:OnLabelTextChanged( string txt )
A hook called when the player presses Enter (i. e. the finished editing the label) and the text has changed. Allows you to override/modify the text that will be set to display.
DLabelEditable:SetAutoStretch( boolean stretch )
Sets whether the editable label should stretch to the text entered or not.

Example

Creates a DLabelEditable.

local EditLabel = vgui.Create( "DLabelEditable" ) EditLabel:SetPos( 40, 40 ) EditLabel:SetSize( 70, 30) EditLabel:SetText( "Hello, world!" )