Garry's Mod Wiki

ControlPresets

Description

A preset manager, found at the top of almost every default tool's C-menu.

This control only exists in Sandbox derived gamemodes.

View source

Parent

Derives methods, etc not listed on this page from Panel.

Methods

ControlPresets:AddConVar( string convar )
Adds a convar to be managed by this control.
ControlPresets:AddOption( string strName, any data )
Adds option to the DComboBox subelement with DComboBox:AddChoice then adds it to the options subtable
ControlPresets:Clear()
Runs Panel:Clear on the Internal DComboBox
table ControlPresets:GetConVars()
Get a list of all Console Variables being managed by this panel.
ControlPresets:OnSelect( number index, any value, table data )
Checks if Data is valid then uses pairs to iterate over the data parameter and run each entry using RunConsoleCommand Index and Value parameters appear to not be used. Further testing should be done to confirm
ControlPresets:OpenPresetEditor()
Creates and opens PresetEditor
ControlPresets:QuickSaveInternal( string text )
ControlPresets:QuickSavePreset()
ControlPresets:ReloadPresets()
ControlPresets:SetLabel( string name )
Set the name label text.
ControlPresets:SetOptions( table Options )
Uses table. Merge to combine the provided table into the Options subtable
ControlPresets:SetPreset( string strName )
ControlPresets:Update()
Alias of ControlPresets:ReloadPresets