Garry's Mod Wiki

Revision Difference

DTextEntry:OnEnter#551764

<function name="OnEnter" parent="DTextEntry" type="panelhook"> <ispanel>yes</ispanel> <description> Called whenever enter is pressed on a <page>DTextEntry</page>. <note><page>DTextEntry:IsEditing</page> will still return true in this callback!</note> </description> <realm>Client and Menu</realm> <args> <arg name="value" type="string" added="2020.06.24">The current text of the <page>DTextEntry</page></arg> </args> </function> <example> <code> local TextEntry = vgui.Create( "DTextEntry" ) TextEntry:SetTextColor( Color( 255, 0, 0, 255 ) ) ⤶ TextEntry.OnEnter = function() TextEntry:SetTextColor( Color( 0, 0, 255, 255 ) )⤶ ⤶ TextEntry.OnEnter = function( value ) print("You typed: ", value) end </code> <output>Changes the text color when enter is pressed.</output> <output>Whatever string was typed into the DTextEntry appears in console when enter is pressed.</output> </example>