Garry's Mod Wiki

Derma_StringRequest

  Panel Derma_StringRequest( string title, string subtitle, string default, function confirm, function cancel = nil, string confirmText = "OK", string cancelText = "Cancel" )

Description

Creates a derma window asking players to input a string.

Arguments

1 string title
The title of the created panel.
2 string subtitle
The text above the input box.
3 string default
The default text for the input box.
4 function confirm
The function to be called once the user has confirmed their input.
Function argument(s):
1 string text - The text the player entered.
5 function cancel = nil
The function to be called once the user has cancelled their input.
Function argument(s):
1 string text - The text the player entered.
6 string confirmText = "OK"
Allows you to override text of the "OK" button
7 string cancelText = "Cancel"
Allows you to override text of the "Cancel" button

Returns

1 Panel
The created DFrame

Example

Asks the user to input a string which is then printed to their console

Derma_StringRequest( "Console Print", "Input the string to print to console", "", function(text) print(text) end, function(text) print("Cancelled input") end )
Output: