DTextEntry.ConVarChanged

From GMod Wiki

Jump to: navigation, search
Function
Syntax DTextEntry:ConVarChanged( Panel TextEntry Object, String New Value )
Where is this used?
Description:
Called when the ConVar value associated with a DTextEntry is updated.
Returns: nil
Part of Library: DTextEntry
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DTextEntry.ConVarChanged]DTextEntry.ConVarChanged [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionAlert the user each time the ConVar is updated.
Used onNewerClient.png
Code
local ParentPanel = vgui.Create("DFrame")
	ParentPanel:SetSize(ScrW()/7, ScrH()/12)
	ParentPanel:Center()
	ParentPanel:SetTitle("ConVarChanged Test")
	ParentPanel:SetDeleteOnClose(true)
	ParentPanel:MakePopup()
 
local TextEntry = vgui.Create( "DTextEntry", ParentPanel )
	TextEntry:SetSize(ScrW()/9, ScrH()/30)
	TextEntry:SetValue("ConVarChanged Test")
	TextEntry:SetPos(ParentPanel:GetWide()/2-TextEntry:GetWide()/2,
	ParentPanel:GetTall()/2-TextEntry:GetTall()/5)
	TextEntry:SetEnterAllowed(true)
	TextEntry:SetConVar("some_console_variable") -- Console variable should exist already
	TextEntry.ConVarChanged = function(TextEntryObject, NewValue)
		LocalPlayer():ChatPrint("ConVar value changed to: "..NewValue)
	end
OutputN/A

Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox