DTextEntry.OnEnter

From GMod Wiki

Jump to: navigation, search
Function
Syntax DTextEntry:OnEnter( )
Where is this used?
Description:
Executes a function when enter is pressed.
Returns: nil
Part of Library: DTextEntry
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DTextEntry.OnEnter]DTextEntry.OnEnter [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

Descriptionthis will get the text in the bar, and print it to your chat.
Used onNewerClient.png
Code
local main = vgui.Create("DFrame") //create a normal frame
main:SetSize(300,50) //make it 300 by 50 pixels wide
main:MakePopup() // make it work
main:Center() // place it in the middle of your screen
 
local Entry = vgui.Create("DTextEntry",main) //create a Text Entry, and parent it to main.
Entry:SetPos(25,15)// position it.
Entry:SetMultiline(false) // we only want it to have 1 line.
Entry.OnEnter = function() // create the function.
LocalPlayer():ChatPrint("You wrote: "..Entry:GetValue())//make it print what you entered in.
end // end the function
OutputYou wrote: I like cookies!

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox