Skip to content

mwseMCMTextField⚓︎

A TextField allows you to enter a single line of text and submit with a button. You can also force it to only accept numbers with the numbersOnly field.

This type inherits the following: mwseMCMSetting, mwseMCMComponent

Properties⚓︎

buttonText⚓︎

The text shown on the button next to the input field. The default text is a localized version of: "Submit".

Returns:

  • result (string)

callback⚓︎

The custom function called when the player interacts with this Setting.

Returns:


childIndent⚓︎

The left padding size in pixels. Used on all the child components.

Returns:

  • result (integer, nil)

childSpacing⚓︎

The bottom border size in pixels. Used on all the child components.

Returns:

  • result (integer, nil)

class⚓︎

Every MCM component has a unique string indentifier specific to that component. These strings are the filename of the file implementing a component. These are found in core\\mcm\\components.

Returns:

  • result (string)

componentType⚓︎

The type of this component.

Returns:

  • result ("Setting")

createContentsContainer⚓︎

This method creates the contents of a component. Not every component implements this method.

Returns:


description⚓︎

If in a Sidebar Page, the description will be shown on mouseover.

Returns:

  • result (string, nil)

elements⚓︎

This dictionary-style table holds all the UI elements of the TextField, for easy access.

Returns:


indent⚓︎

The left padding size in pixels. Only used if the childIndent isn't set on the parent component.

Returns:

  • result (integer)

inGameOnly⚓︎

If true, the setting is disabled while the game is on main menu. If this is enabled, it will override the value of the inGameOnly parameter on this setting's variable.

Returns:

  • result (boolean)

label⚓︎

Text shown above the text field.

Returns:

  • result (string)

makeComponent⚓︎

This method must be implemented by child classes of mwseMCMSetting.

Returns:


minHeight⚓︎

The minimum height set on the self.elements.border UI element.

Returns:

  • result (integer, nil)

mouseOvers⚓︎

This array of UI elements will have an event handler registered to trigger "MCM:MouseOver" event. For more info, see registerMouseOverElements method.

Returns:


numbersOnly⚓︎

If true, only numbers will be allowed in this TextField.

Returns:

  • result (boolean)

paddingBottom⚓︎

The bottom border size in pixels. Only used if the childSpacing is unset on the parent component.

Returns:

  • result (integer)

parentComponent⚓︎

Returns:


postCreate⚓︎

Custom formatting function to make adjustments to any element saved in self.elements.

Returns:


restartRequired⚓︎

If true, updating this Setting will notify the player to restart the game.

Returns:

  • result (boolean)

restartRequiredMessage⚓︎

The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect.".

Returns:

  • result (string)

sCancel⚓︎

Set to the value of sCancel GMST.

Returns:

  • result (string)

sNewValue⚓︎

The message shown after a new value is submitted. This can be formatted with a '%s' which will be replaced with the new value. The default text is a localized version of: "New value: '%s'".

Returns:

  • result (string)

sNo⚓︎

Set to the value of sNo GMST.

Returns:

  • result (string)

sOff⚓︎

Set to the value of sOff GMST.

Returns:

  • result (string)

sOK⚓︎

Set to the value of sOK GMST.

Returns:

  • result (string)

sOn⚓︎

Set to the value of sOn GMST.

Returns:

  • result (string)

sYes⚓︎

Set to the value of sYes GMST.

Returns:

  • result (string)

variable⚓︎

The Variable this setting will update.

Returns:


Methods⚓︎

callback⚓︎

This method is called when setting is updated. Shows a messageBox with self.sNewValue with curent variable value formatted in.

myObject:callback()

checkDisabled⚓︎

Returns true if the component should be disabled.

Componets with a variable:

  • True if the Component's variable has inGameOnly field set to true, and the game is on the main menu. For components with multiple subcomponent (Category), the check is done for each subcomponent.

Components without a variable:

  • True if the Component's inGameOnly field is set to true, and the game is on the main menu.
local result = myObject:checkDisabled()

Returns:

  • result (boolean)

convertToLabelValue⚓︎

This function specifies how values stored in the variable field should correspond to values displayed by this setting.

local labelValue = myObject:convertToLabelValue(variableValue)

Parameters:

  • variableValue (number)

Returns:

  • labelValue (number, string)

create⚓︎

This method creates the UI elements that comprise this Setting.

myObject:create(parentBlock)

Parameters:


createContentsContainer⚓︎

This method creates the UI elements specific to TextField.

myObject:createContentsContainer(parentBlock)

Parameters:


createInnerContainer⚓︎

Creates component's innerContainer UI element inside given parentBlock, and stores it in the self.elements.innerContainer. The innerContainer will add self.indent additional padding on the left if the component has a label.

myObject:createInnerContainer(parentBlock)

Parameters:


createLabel⚓︎

Creates component's label UI element.

First, it calls self:createLabelBlock and creates the label element inside new labelBlock. Stores both new UI elements in the self.elements and self.mouseOvers.

myObject:createLabel(parentBlock)

Parameters:


createLabelBlock⚓︎

Creates component's labelBlock UI element inside given parentBlock, and stores it in the self.elements.labelBlock and self.mouseOvers.

myObject:createLabelBlock(parentBlock)

Parameters:


createOuterContainer⚓︎

Creates component's outerContainer UI element inside given parentBlock, and stores it in the self.elements.outerContainer and self.mouseOvers. The outerContainer holds all the other UI elements that comprise a component.

myObject:createOuterContainer(parentBlock)

Parameters:


createSubmitButton⚓︎

This method creates the submit button UI element and stores it in self.elements.submitButton.

myObject:createSubmitButton(parentBlock)

Parameters:


disable⚓︎

This method disables the component's UI elements. That includes: changing the color of the UI elements to the tes3.palette.disabledColor and setting button widget state to tes3.uiState.disabled.

myObject:disable()

enable⚓︎

Enables the component's UI elements. That includes: changing the color of the UI elements to the tes3.palette.normalColor and registering handlers for tes3.uiEvent.mouseClick for buttons.

myObject:enable()

getComponent⚓︎

Creates a new Component of given class or returns the given Component.

local component = myObject:getComponent({ class = ..., label = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., inGameOnly = ..., postCreate = ..., parentComponent = ... })

Parameters:

  • componentData (mwseMCMComponent, table)
    • class (string): The component type to get. On of the following:
      • "Template"
      • "ExclusionsPage"
      • "FilterPage"
      • "MouseOverPage"
      • "Page"
      • "SideBarPage"
      • "Category"
      • "SideBySideBlock"
      • "ActiveInfo"
      • "Hyperlink"
      • "Info"
      • "MouseOverInfo"
      • "Setting"
      • "Button"
      • "OnOffButton"
      • "YesNoButton"
      • "CycleButton"
      • "KeyBinder"
      • "Dropdown"
      • "TextField"
      • "ParagraphField"
      • "Slider"
      • "DecimalSlider"
      • "PercentageSlider"
    • label (string): Optional. The label text to set for the new component. Not all component types have a label.
    • indent (integer): Default: 12. The left padding size in pixels. Only used if the childIndent isn't set on the parent component.
    • childIndent (integer): Optional. The left padding size in pixels. Used on all the child components.
    • paddingBottom (integer): Default: 4. The bottom border size in pixels. Only used if the childSpacing is unset on the parent component.
    • childSpacing (integer): Optional. The bottom border size in pixels. Used on all the child components.
    • inGameOnly (boolean): Default: false.
    • postCreate (fun(self: mwseMCMComponent)): Optional. Can define a custom formatting function to make adjustments to any element saved in self.elements.
    • parentComponent (mwseMCMComponent): Optional.

Returns:


insertMouseovers⚓︎

Recursively walks over children of given element and inserts them into self.mouseOvers.

myObject:insertMouseovers(element)

Parameters:


makeComponent⚓︎

This method creates the border and inputField UI elements of the TextField.

myObject:makeComponent(parentBlock)

Parameters:


new⚓︎

Creates a new TextField.

local textField = myObject:new({ label = ..., buttonText = ..., variable = ..., numbersOnly = ..., description = ..., press = ..., sNewValue = ..., minHeight = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ..., class = ..., componentType = ..., parentComponent = ... })

Parameters:

  • data (table): Optional.
    • label (string): Optional. Text shown above the text field.
    • buttonText (string): Optional. The text shown on the button next to the input field. The default text is a localized version of: "Submit".
    • variable (mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this setting.
    • numbersOnly (boolean): Default: false. If true, only numbers will be allowed in this TextField.
    • description (string): Optional. If in a Sidebar Page, the description will be shown on mouseover.
    • press (fun(self: mwseMCMTextField)): Optional. This allows overriding the default implementation of this method. Can be overriden to add a confirmation message before updating. This function should call self:update() at the end.
    • sNewValue (string): Optional. The message shown after a new value is submitted. This can be formatted with a '%s' which will be replaced with the new value. The default text is a localized version of: "New value: '%s'".
    • minHeight (integer): Optional. The minimum height set on the self.element.border UI element.
    • callback (fun(self: mwseMCMTextField)): Optional. This allows overriding the default implementation of this method. See its description.
    • inGameOnly (boolean): Default: false. If true, the setting is disabled while the game is on main menu.
    • restartRequired (boolean): Default: false. If true, updating this Setting will notify the player to restart the game.
    • restartRequiredMessage (string): Optional. The message shown if restartRequired is triggered. The default text is a localized version of: "The game must be restarted before this change will come into effect."
    • indent (integer): Default: 12. The left padding size in pixels. Only used if the childIndent isn't set on the parent component.
    • childIndent (integer): Optional. The left padding size in pixels. Used on all the child components.
    • paddingBottom (integer): Default: 4. The bottom border size in pixels. Only used if the childSpacing is unset on the parent component.
    • childSpacing (integer): Optional. The bottom border size in pixels. Used on all the child components.
    • postCreate (fun(self: mwseMCMTextField)): Optional. Can define a custom formatting function to make adjustments to any element saved in self.elements.
    • class (string): Optional.
    • componentType (string): Optional.
    • parentComponent (mwseMCMComponent): Optional.

Returns:


prepareData⚓︎

Prepares the provided parameters table and sets the parentComponent field to mwseMCMComponent.

local data = myObject:prepareData(data)

Parameters:

  • data (string, mwseMCMComponent.new.data): Optional.

Returns:

  • data (mwseMCMComponent.new.data)

press⚓︎

Calls the update method.

myObject:press()

printComponent⚓︎

Prints the component table to the mwse.log. If a component is passed, it will be printed. If called without arguments, the component it was called on will be printed.

myObject:printComponent(component)

Parameters:

  • component (table): Default: self.

registerMouseOverElements⚓︎

Registers an event handler on each given UI element for the tes3.uiEvent.mouseOver and tes3.uiEvent.mouseLeave that will trigger "MCM:MouseOver" event. That event is used by the MCM to update the sidebar on the mwseMCMSideBarPage.

myObject:registerMouseOverElements(mouseOverList)

Parameters:

  • mouseOverList (tes3uiElement[]): Optional. If this argument isn't passed, does nothing.

update⚓︎

Updates the variable's value to the current text in the text input element. If self.numbersOnly is true, it only allows setting the new value to a number.

myObject:update()