Garry's Mod Wiki

DTextEntry:AllowInput

  boolean DTextEntry:AllowInput( string char )

Description

Called whenever the value of the panel has been updated (whether by user input or otherwise).

It allows you to determine whether a user can modify the TextEntry's text.

By default, this only checks whether the panel disallows numeric characters, preventing it from being edited if the value contains any.

This is actually an engine hook that only works on TextEntry derived elements.

If you are looking for a way to modify character limits, see Panel:SetMaximumCharCount

Arguments

1 string char
The last character entered into the panel.

Returns

1 boolean
Return true to prevent the value from changing, false to allow it.

Example

Prevents the user from editing the text entirely.

local TextEntry = vgui.Create( "DTextEntry" ) TextEntry.AllowInput = function( self, stringValue ) return true end
Output: The panel does not allow any alterations.