Panel/SetConVar

From Garry's Mod
Jump to: navigation, search
 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