PrinterKit | Wiki

UI Controls

There are several built in UI controls that can be added to scripts. These add user interface elements that allow editing of script parameters.

UI Slider Int

Creates a slider control that returns an integer from a specified range.

result = UiSliderInt(string name, int minValue, int maxValue, int defaultValue)

intValue = UiSliderInt("Int Slider", 0, 10, 5)
print(tostring(intValue))

UI Slider Float

Creates a slider control that returns an float from a specified range.

result = UiSliderFloat(string name, float minValue, float maxValue, float defaultValue)

floatValue = UiSliderFloat("Float Slider",-20.0, 20.0, 0.0)
print(tostring(floatValue))

UI Dropdown

Select a value from a list of key/value pairs.

result = UiDropdown(string name, table items, string defaultKey)

resultValue = UiDropdown("Key Selected", {item1="five", item2=2, item3=true}, "item1")
print(tostring(resultValue))

UI File

Select a file of a specified file extention.

result = UiFile(string name, string fileExtension, string defaultPath)

filePath = UiFile("Text Path","*.txt","")
print(tostring(filePath))

UI Checkbox

Create a checkbox to select a true or false value.

result = UiCheckbox(string name, bool defaultValue)

boolValue = UiCheckbox("CheckBox", false)
print(tostring(boolValue))

UI Radio

Click on a list of radio buttons defined by key/value pairs.

result = UiRadio(string name, table items, string defaultKey)

radio = UiRadio("Item Selected", {item1="five", item2=2, item3=true}, "item1")
print(tostring(radio))

UI Textbox

Create a textbox that accepts textual data. Press the enter key to commit changed text.

result = UiTextbox(string name, string defaultValue)

stringValue = UiTextbox("Textbox", "Starting Text")
print(stringValue)

UI Seed

Used to generate a random number. Click the "generate" button for a new value.

result = UiSeed(string name, uint defaultValue)

seedValue = UiSeed("Seed", 1)
print(tostring(seedValue))