Defines cwBasicForm, a DPanelList-based form with helpers for adding labelled controls bound to console variables.

Offers the same helpers as DForm (TextEntry, ComboBox, NumberWang, NumSlider, CheckBox, Help, ControlHelp, Button, PanelSelect, ListBox) plus SetText for the header.

Summary

Methods

Adds a row to the form made of a label and a control.
Adds a button, optionally running a console command when clicked.
Adds a labelled check box bound to a console variable.
Adds a labelled combo box that sets a console variable when an option is picked.
Adds a centred, wrapped help label for the control above it.
Adds a wrapped help text label to the form.
Adds a list box, preceded by a label when one is given.
Adds a labelled number wang bound to a console variable.
Adds a number slider bound to a console variable.
Adds an empty panel select to the form.
Sets the form's header text, creating the header label on first use.
Adds a labelled text entry bound to a console variable.

Methods

PANEL:AddLeftRight(left, right)

client gamemodes/catwork/gamemode/core/derma/cl_basicform.lua:69

Adds a row to the form made of a label and a control.

When right is valid, both panels are placed side by side in a new row, with right offset 110 pixels from the left. Otherwise left is added on its own; nothing is added when neither is valid.

Parameters

  • left Panel Panel shown on the left, usually a label
  • right Panel optional, defaults to nil Panel shown on the right

PANEL:Button(strName, strConCommand, ...)

client gamemodes/catwork/gamemode/core/derma/cl_basicform.lua:261

Adds a button, optionally running a console command when clicked.

Parameters

  • strName String Button text
  • strConCommand String optional, defaults to nil Console command to run on click
  • ... Any Arguments passed to the console command

Returns

  • Panel The DButton

PANEL:CheckBox(strLabel, strConVar)

client gamemodes/catwork/gamemode/core/derma/cl_basicform.lua:196

Adds a labelled check box bound to a console variable.

Parameters

  • strLabel String Label text
  • strConVar String Console variable the check box reads and writes

Returns

  • Panel The DCheckBoxLabel

PANEL:ComboBox(strLabel, strConVar)

client gamemodes/catwork/gamemode/core/derma/cl_basicform.lua:117

Adds a labelled combo box that sets a console variable when an option is picked.

The console variable is set to the option's data, or its text when it has no data.

Parameters

  • strLabel String Label text
  • strConVar String Console variable to set

Returns

  • Panel The DComboBox
  • Panel The label

Adds a centred, wrapped help label for the control above it.

Parameters

  • strHelp String Help text

Returns

  • Panel The label

Adds a wrapped help text label to the form.

Parameters

  • strHelp String Help text

Returns

  • Panel The label

Adds a list box, preceded by a label when one is given.

Parameters

  • strLabel String optional, defaults to nil Label text shown above the list box

Returns

  • Panel The DListBox
  • Panel The label, or nil when no label text was given

PANEL:NumberWang(strLabel, strConVar, numMin, numMax, numDecimals)

client gamemodes/catwork/gamemode/core/derma/cl_basicform.lua:145

Adds a labelled number wang bound to a console variable.

Parameters

  • strLabel String Label text
  • strConVar String Console variable the wang reads and writes
  • numMin Number Smallest allowed value
  • numMax Number Largest allowed value
  • numDecimals Number optional, defaults to nil Number of decimal places to show

Returns

  • Panel The DNumberWang
  • Panel The label

PANEL:NumSlider(strLabel, strConVar, numMin, numMax, numDecimals)

client gamemodes/catwork/gamemode/core/derma/cl_basicform.lua:173

Adds a number slider bound to a console variable.

Parameters

  • strLabel String Label text
  • strConVar String Console variable the slider reads and writes
  • numMin Number Smallest allowed value
  • numMax Number Largest allowed value
  • numDecimals Number optional, defaults to nil Number of decimal places to show

Returns

  • Panel The DNumSlider

Adds an empty panel select to the form.

Returns

  • Panel The DPanelSelect

PANEL:SetText(text, fontName, color, size)

client gamemodes/catwork/gamemode/core/derma/cl_basicform.lua:19

Sets the form's header text, creating the header label on first use.

The label is drawn over a highlighted box and stretched to the form's width.

Parameters

  • text String Text of the header
  • fontName String optional, defaults to nil Font to use; defaults to the menu_text_tiny theme font
  • color Color optional, defaults to nil Text color, or the name of a theme color; defaults to basic_form_color
  • size Number optional, defaults to nil Font size; defaults to 16 when no font is given, otherwise keeps the font's size

PANEL:TextEntry(strLabel, strConVar)

client gamemodes/catwork/gamemode/core/derma/cl_basicform.lua:95

Adds a labelled text entry bound to a console variable.

Parameters

  • strLabel String Label text
  • strConVar String Console variable the entry reads and writes

Returns

  • Panel The DTextEntry
  • Panel The label

Defined in