Garry's Mod Wiki

DForm

Description

An easy form with functions to quickly add form elements

View source

Parent

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

Implements

Implements or overrides the following hooks/methods. If you want to override these, you probably want to call the original function too.

Methods

DForm:AddItem( Panel left, Panel right = nil )
Adds one or two items to the DForm. If this method is called with only one argument, it is added to the bottom of the form. If two arguments are passed, they are placed side-by-side at the bottom of the form. Internally, this function is used by the various DForm functions to, for example, add labels to the left of buttons.
Panel DForm:Button( string text, string concommand, vararg args )
Adds a DButton onto the DForm
Panel DForm:CheckBox( string label, string convar )
Adds a DCheckBoxLabel onto the DForm. This will run DCheckBoxLabel:OnChange when being added. This is caused by Panel:SetConVar being used when this function is used. To avoid this, use DForm:AddItem with a DCheckBoxLabel.
Panel, Panel DForm:ComboBox( string title, string convar )
Adds a DComboBox onto the DForm
Panel DForm:ControlHelp( string help )
Adds a DLabel onto the DForm. Unlike DForm:Help, this is indented and is colored blue, depending on the derma skin.
We advise against using this. It may be changed or removed in a future update. An Accessor Function in DForm that does nothing.
We advise against using this. It may be changed or removed in a future update. An AccessorFunc that does nothing.
Panel DForm:Help( string help )
Adds a DLabel onto the DForm as a helper
Panel, Panel DForm:ListBox( string label )
Adds a DListBox onto the DForm We advise against using this. It may be changed or removed in a future update. Use DListView with DForm:AddItem instead.
Panel, Panel DForm:NumberWang( string label, string convar, number min, number max, number decimals = nil )
Adds a DNumberWang onto the DForm
Panel DForm:NumSlider( string label, string convar, number min, number max, number decimals = nil )
Adds a DNumSlider onto the DForm
We advise against using this. It may be changed or removed in a future update. This is derived from the deprecated DPanelSelect. Creates a DPanelSelect and docks it to the top of the DForm.
Panel DForm:PropSelect( string label, string convar, table models, number height = 2 )
Creates a PropSelect panel and docks it to the top of the DForm.
DForm:Rebuild()
We advise against using this. It may be changed or removed in a future update. Does nothing.
DForm:SetAutoSize( boolean arg1 )
We advise against using this. It may be changed or removed in a future update. an AccessorFunc that does nothing
DForm:SetName( string name )
Sets the title (header) name of the DForm. This is Label until set.
DForm:SetSpacing( number arg1 )
We advise against using this. It may be changed or removed in a future update. An AccessorFunc that does nothing.
Panel, Panel DForm:TextEntry( string label, string convar )
Adds a DTextEntry to a DForm