Panel/SetConVar

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
m (Formatting.)
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=SetConVar
+
|Description={{Warning|This function does not exist on all panels}}
|Parent=Panel
+
 
|Description=Sets this panel's convar. When the convar changes this panel will update automatically.
+
Sets this panel's convar. When the convar changes this panel will update automatically.
  
 
For developer implementation, see {{GlobalFunction|Derma_Install_Convar_Functions}}.
 
For developer implementation, see {{GlobalFunction|Derma_Install_Convar_Functions}}.

Revision as of 08:32, 13 November 2017

 Panel:SetConVar( )

Contents

Description

WARNING

This function does not exist on all panels

Sets this panel's convar. When the convar changes this panel will update automatically.

For developer implementation, see Derma_Install_Convar_Functions.

Arguments

string convar

The console variable to check.

Examples

Example

Makes a checkbox linked to the sv_cheats convar.

local checkbox = vgui.Create( "DCheckBoxLabel", myFrame )
checkbox:SetConVar( "sv_cheats" )
checkbox:SetText( "Enable cheats?" )
checkbox:SetPos( 5, 25 )
checkbox:SizeToContents()

Output:

A checkbox which adapts to the value of the sv_cheats convar value. checkbox SetConVar.jpg
Personal tools
Navigation