DTextEntry/AllowInput

From Garry's Mod
Jump to: navigation, search
 DTextEntry:AllowInput( )

Contents

DescriptionPanelFunc

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.

Arguments

string char

The last character entered into the panel.

Returns

boolean

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

Examples

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.
Personal tools
Navigation