Garry's Mod Wiki

DTextEntry:OnEnter

  DTextEntry:OnEnter( string value )

Description

Called whenever enter is pressed on a DTextEntry.

DTextEntry:IsEditing will still return true in this callback!

Arguments

1 string value
The current text of the DTextEntry

Example

local TextEntry = vgui.Create( "DTextEntry" ) function TextEntry:OnEnter( value ) print("You typed: ", value) end

Example

local TextEntry = vgui.Create( "DTextEntry" ) TextEntry.OnEnter = function( self ) -- Alternative method, outputs DTextEntry object. print("You typed: ", self:GetValue()) -- Use self:GetValue() to grab the string. end
Output: Whatever string was typed into the DTextEntry appears in console when enter is pressed.