DTextEntry/OnGetFocus

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Creation of OnGetFocus page as a useful func to override)
 
 
Line 1: Line 1:
{{PanelFunc
+
{{PanelHook
 
|Description=Called whenever the DTextEntry gains focus.
 
|Description=Called whenever the DTextEntry gains focus.
 
}}
 
}}

Latest revision as of 16:57, 24 September 2019

 DTextEntry:OnGetFocus( )

DescriptionPanelHook

Called whenever the DTextEntry gains focus.

Examples

Example

local dTextEntry = vgui.Create("DTextEntry")
dTextEntry:SetText("Enter text here")

dTextEntry.OnGetFocus = function()
    self:SetText("") -- Clear the text box for user input
end

Output:

Text entry clears when user clicks it to begin typing
Personal tools
Navigation