Garry's Mod Wiki

Revision Difference

DTextEntry:OnLoseFocus#550653

<title>DTextEntry:OnLoseFocus</title> <function name="OnLoseFocus" parent="DTextEntry" type="panelfunc"> <ispanel>yes</ispanel> <description>Called whenever the DTextEntry lose focus.</description> <realm>Client</realm>⤶ <realm>Client and Menu</realm>⤶ </function> <example> <code> local default = "Brick with bob" local textentry = vgui.Create( "DTextEntry" ) textentry:SetText( default ) textentry.OnLoseFocus = function( self ) if self:GetValue() == "" then self:SetValue( default ) end end </code> <output>DTextEntry value reset to default value if the text entered is empty.</output> </example>