Garry's Mod Wiki

DTextEntry:OnGetFocus

  DTextEntry:OnGetFocus()

Description

Called whenever the DTextEntry gains focus.

Example

local dTextEntry = vgui.Create("DTextEntry") dTextEntry:SetText("Enter text here") -- Make the text field clear when you click into it. dTextEntry.OnGetFocus = function(self) self:SetValue("") end
Output: Text entry clears when user clicks it to begin typing