Garry's Mod Wiki

Revision Difference

DTextEntry:OnGetFocus#526479

<function name="OnGetFocus" parent="DTextEntry" type="panelfunc"> <ispanel>yes</ispanel> <description>Called whenever the DTextEntry gains focus.</description> <realm>Client</realm> </function> <example> <code> local dTextEntry = vgui.Create("DTextEntry") dTextEntry:SetText("Enter text here") ⤶ dTextEntry.OnGetFocus = function() self:SetText("") -- Clear the text box for user input⤶ ⤶ -- Make the text field clear when you click into it. dTextEntry.OnGetFocus = function(self)⤶ self:SetValue("")⤶ end </code> <output>Text entry clears when user clicks it to begin typing</output> </example>