-- Create a new frame (window)local frame =vgui.Create( "DFrame" )
frame:SetSize( 300, 300 ) -- Set the size of the frameframe:Center() -- Center the frame on the screenframe:MakePopup() -- Make the frame appear in front of other windows and accept user input-- Create a text entry field within the framelocal tEntry =vgui.Create("DTextEntry", frame)
tEntry:Dock(TOP) -- Dock the text entry at the top of the frametEntry:SetHistoryEnabled(true) -- Dock the text entry at the top of the frame
tEntry.OnEnter =function( self )
local val =self:GetValue()
self:AddHistory( val ) -- Store old value in history so the player can access it again laterself:SetText( "" ) -- reset the text-- Do something with the data...chat.AddText( val ) -- print the textentry text as a chat messageend