Garry's Mod Wiki

Derma_Install_Convar_Functions

Description

Makes the panel (usually an input of sorts) respond to changes in console variables by adding next functions to the panel:

The console variable value is saved in the m_strConVar property of the panel.

The panel should call Panel:ConVarStringThink or Panel:ConVarNumberThink in its PANEL:Think hook and should call Panel:ConVarChanged when the panel's value has changed.

Arguments

1 Panel target
The panel the functions should be added to.

Example

Adds the functions to a panel (snippet of vgui/dcheckbox.lua)

local PANEL = {} Derma_Install_Convar_Functions( PANEL ) function PANEL:Init() -- Init function here end function PANEL:Think() self:ConVarStringThink() end
Output: The

PANEL

table now contains the functions SetConVar, ConVarChanged, ConVarStringThink and ConVarNumberThink (and an Init function and a Think function)

Page Links


Special Pages


Wikis

?

Render Time: 43ms

DB GetPage 3
Generate Html 10
SaveChanges (1) 16
Render Body 0
Render Sidebar 12