ControlPanel:AddControl
Description
We advise against using this. It may be changed or removed in a future update.
It is recommended to use DForm's members instead.
Adds a control to the control panel.
Arguments
1 string type
The control type to add. The complete list is:
- header
- textbox
- label
- checkbox/toggle
- slider
- propselect
- matselect
- ropematerial
- button
- numpad
- color
- combobox
- listbox
- materialgallery
2 table controlinfo
Each control takes their own table structure. You may search "AddControl" on GitHub for examples.
Here is a full list of each type and the table members it requires:
header
- description
textbox:
- label (def: "Untitled")
- command
label:
- text
checkbox, toggle (same thing):
- label (def: "Untitled")
- command
- help (boolean, if true assumes label is a language string (
#tool.toolname.stuff) and adds.helpat the end)
slider: (DForm:NumSlider)
- type (optional string, if equals
floatthen 2 digits after the decimal will be used, otherwise 0) - label (def:
Untitled) - command
- min (def:
0) - max (def:
100) - help (boolean, see above)
- type (optional string, if equals
propselect:
- (data goes directly to PropSelect's :ControlValues(data))
matselect:
- (data goes directly to MatSelect's :ControlValues(data))
ropematerial:
- convar (notice: NOT called command this time!)
button:
- label / text (if label is missing will use text. Def:
No Label) - command
- label / text (if label is missing will use text. Def:
numpad:
- command
- command2
- label
- label2
color:
- label
- red (convar)
- green (convar)
- blue (convar)
- alpha (convar)
combobox:
- menubutton (if doesn't equal "1", becomes a listbox)
- folder
- options (optional, ha)
- cvars (optional)
listbox:
- height (if set, becomes DListView, otherwise is CtrlListBox)
- label (def:
unknown) - options (optional)
materialgallery:
- width (def:
32) - height (def:
32) - rows (def:
4) - convar
- options
- width (def:
Garry's Mod
Rust
Steamworks
Wiki Help