Category:DTextEntry

From Garry's Mod
Jump to: navigation, search

Contents

DescriptionPanelPage

A form which may be used to display text the player is meant to select and copy or alternately allow them to enter some text of their own . Do note that at least one of your DTextEntry's parents must either be an EditablePanel or derived from it (like a DFrame, for example), else it won't be able to focus and thus be unselectable. You must also call Panel:MakePopup on said panel or the DTextEntry will not work.

BUG

This does not clear out previously-pasted text properly.

Issue Tracker: #1588

Inherited Functions

Inherits the following functions from TextEntry and its parents up to 3 levels deep:


Examples

Example

Creates a text entry form that allows you to print messages into the local player's chat window.

local frame = vgui.Create( "DFrame" )
frame:SetSize( 400, 200 )
frame:Center()
frame:MakePopup()

local TextEntry = vgui.Create( "DTextEntry", frame ) -- create the form as a child of frame
TextEntry:SetPos( 25, 50 )
TextEntry:SetSize( 75, 85 )
TextEntry:SetText( "Placeholder Text" )
TextEntry.OnEnter = function( self )
	chat.AddText( self:GetValue() )	-- print the form's text as server text
end

Output:


DTextEntryExample.png

Methods

Personal tools
Navigation