mwseMCMMouseBinder⚓︎
This button allows the player to bind a key combination for use with hotkeys. It only allow binding of mouse actions and additional modifier keys: Shift, Alt and Ctrl.
When the player presses the button with current hotkey, a prompt asks them to press a new key (or key combination using Shift, Ctrl or Alt) to bind. The key combination is stored as mwseKeyMouseCombo.
This type inherits the following: mwseMCMBinder, mwseMCMButton, mwseMCMSetting, mwseMCMComponent
Properties⚓︎
allowButtons
⚓︎
If true, the MouseBinder will let the user bind mouse buttons. By default, it's set to true.
Returns:
result
(boolean)
allowCombinations
⚓︎
If true, the keybinder will let the user use modification keys: Shift, Ctrl, and Alt when rebinding. Set to true
by default.
Returns:
result
(boolean)
allowWheel
⚓︎
If true, the MouseBinder will let the user bind mouse wheel scroll up or down.
Returns:
result
(boolean)
buttonText
⚓︎
The text shown on the button.
Returns:
result
(string)
callback
⚓︎
The custom function called when the player interacts with this Setting.
Returns:
result
(nil, fun(self: mwseMCMSetting))
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")
config
⚓︎
The config to use when creating a mwseMCMTableVariable
for this Setting
. If provided, it will override the config stored in parentComponent
. Otherwise, the value in parentComponent
will be used.
Returns:
result
(table, nil)
configKey
⚓︎
The configKey
used to create a new mwseMCMTableVariable
. If this is provided, along with a config
(which may be inherited from the parentComponent
), then a new mwseMCMTableVariable
variable will be created for this setting.
Returns:
result
(string, number, nil)
converter
⚓︎
A converter to use for this component's variable
.
Returns:
result
((fun(newValue: unknown): unknown), nil)
createContentsContainer
⚓︎
This method creates the contents of a component. Not every component implements this method.
Returns:
result
(nil, fun(self: mwseMCMComponent, outerContainer: tes3uiElement))
defaultConfig
⚓︎
The defaultConfig
to use when creating a mwseMCMTableVariable
for this Setting
. If provided, it will override the defaultConfig
stored in parentComponent
. Otherwise, the value in parentComponent
will be used.
Returns:
result
(table, nil)
defaultSetting
⚓︎
If defaultSetting
wasn't passed in the variable
table, can be passed here. The new variable will be initialized to this value. If not provided, then the value in defaultConfig
will be used, if possible.
Returns:
result
(unknown, nil)
description
⚓︎
If in a Sidebar Page, the description will be shown on mouseover.
Returns:
result
(string, nil)
disabledText
⚓︎
This text is shown on the button if the buttonText
isn't set.
Returns:
result
(string)
elements
⚓︎
This dictionary-style table holds all the UI elements of the Button, for easy access.
Returns:
result
(mwseMCMButtonElements)
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)
keybindName
⚓︎
The keybind name. Shown in the popup menu header. This string is formatted into a localized version of "SET %s KEYBIND". If none is provided the popup has "SET NEW KEYBIND" as header text.
Returns:
result
(string, nil)
label
⚓︎
The text shown next to the button.
Returns:
result
(string)
leftSide
⚓︎
If true, the Button is created on the left, while the label text is created on the right. If false, label text is on the left.
Returns:
result
(boolean)
makeComponent
⚓︎
This method must be implemented by child classes of mwseMCMSetting.
Returns:
result
(nil, fun(self: mwseMCMSetting, innerContainer: tes3uiElement))
mouseOvers
⚓︎
This array of UI elements will have an event handler registered to trigger "MCM:MouseOver" event. For more info, see registerMouseOverElements method.
Returns:
result
(tes3uiElement[], nil)
observeEvents
⚓︎
The events on which this Binder will register user input.
Returns:
result
(table<tes3.event, true>)
paddingBottom
⚓︎
The bottom border size in pixels. Only used if the childSpacing
is unset on the parent component.
Returns:
result
(integer)
parentComponent
⚓︎
Returns:
result
(mwseMCMComponent, nil)
postCreate
⚓︎
Custom formatting function to make adjustments to any element saved in self.elements
.
Returns:
result
(nil, fun(self: mwseMCMComponent))
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)
showDefaultSetting
⚓︎
If true, then the defaultSetting
of this setting's variable
will be shown below its description.
Returns:
result
(boolean)
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:
result
(mwseMCMVariable, nil)
Methods⚓︎
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
⚓︎
Method is set to getComboString
.
local labelValue = myObject:convertToLabelValue(keyCombo)
Parameters:
keyCombo
(mwseKeyMouseCombo)
Returns:
labelValue
(string)
create
⚓︎
This method creates the UI elements that comprise this Setting.
myObject:create(parentBlock)
Parameters:
parentBlock
(tes3uiElement)
createContentsContainer
⚓︎
This method creates the Button's button and label UI elements.
myObject:createContentsContainer(parentBlock)
Parameters:
parentBlock
(tes3uiElement)
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:
parentBlock
(tes3uiElement)
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:
parentBlock
(tes3uiElement)
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:
parentBlock
(tes3uiElement)
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:
parentBlock
(tes3uiElement)
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()
getComboString
⚓︎
Returns a string representing given keyCombo
. For example, "Ctrl - C".
local result = myObject:getComboString(keyCombo)
Parameters:
keyCombo
(mwseKeyMouseCombo)
Returns:
result
(string)
getHelpText
⚓︎
Returns localized help text based on which input can be used in the Binder.
local helpText = myObject:getHelpText()
Returns:
helpText
(string)
getKeyComboFromEventData
⚓︎
Used to convert raw input event data into mwseKeyMouseCombo
.
local keyCombo = myObject:getKeyComboFromEventData(e)
Parameters:
e
(keyDownEventData, mouseWheelEventData, mouseButtonDownEventData, mwseKeyMouseCombo)
Returns:
keyCombo
(mwseKeyMouseCombo)
getMouseOverText
⚓︎
Retrieves the text that this setting should display in any related mouseOverInfo
s. This method currently utilized to display this component's description whenever the component is in a SideBarPage
. If this Setting
has showDefaultSetting == true
, then this method will also include the current defaultSetting
.
Primarily intended for internal use.
local text = myObject:getMouseOverText()
Returns:
text
(string, nil): The text to display. Returningnil
means that themouseOverInfo
should display text from a different source. e.g. from thedescription
of the relevantSideBarPage
.
getText
⚓︎
Returns the current button text.
local buttonText = myObject:getText()
Returns:
buttonText
(string)
insertMouseovers
⚓︎
Recursively walks over children of given element
and inserts them into self.mouseOvers
.
myObject:insertMouseovers(element)
Parameters:
element
(tes3uiElement)
isUnbound
⚓︎
Returns true if given mwseKeyMouseCombo
represents unbound key.
local isUnbound = myObject:isUnbound(keyCombo)
Parameters:
keyCombo
(mwseKeyMouseCombo)
Returns:
isUnbound
(boolean)
keySelected
⚓︎
Changes the variable.value
to the key combination.
myObject:keySelected(keyCombo)
Parameters:
keyCombo
(mwseKeyMouseCombo)
makeComponent
⚓︎
This method creates the Button's button UI element and stores it in self.elements.button
and self.mouseOvers
.
myObject:makeComponent(parentBlock)
Parameters:
parentBlock
(tes3uiElement)
new
⚓︎
Creates a new MouseBinder.
local button = myObject:new({ label = ..., description = ..., allowCombinations = ..., allowButtons = ..., allowWheel = ..., keybindName = ..., leftSide = ..., variable = ..., defaultSetting = ..., callback = ..., inGameOnly = ..., restartRequired = ..., restartRequiredMessage = ..., indent = ..., childIndent = ..., paddingBottom = ..., childSpacing = ..., postCreate = ..., class = ..., componentType = ..., parentComponent = ... })
Parameters:
data
(table): Optional.label
(string): Optional. Text shown next to the button.description
(string): Optional. If in a Sidebar Page, the description will be shown on mouseover.allowCombinations
(boolean): Default:true
. If true, the MouseBinder will let the user use modification keys: Shift, Ctrl, and Alt when rebinding.allowButtons
(boolean): Default:true
. If true, the MouseBinder will let the user bind mouse buttons.allowWheel
(boolean): Default:false
. If true, the MouseBinder will let the user bind mouse wheel scroll up or down.keybindName
(string): Optional. The keybind name. Shown in the popup menu header. This string is formatted into a localized version of "SET %s KEYBIND.". If none is provided the popup has "SET NEW KEYBIND." as header text.leftSide
(boolean): Default:true
. If true, the button will be created on the left and label on the right.variable
(mwseMCMVariable, mwseMCMSettingNewVariable): Optional. A variable for this MouseBinder.defaultSetting
(mwseKeyMouseCombo): Optional. IfdefaultSetting
wasn't passed in thevariable
table, can be passed here. The new variable will be initialized to this value.callback
(fun(self: mwseMCMMouseBinder)): Optional. The custom function called when the player interacts with this MouseBinder.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 thechildIndent
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 thechildSpacing
is unset on the parent component.childSpacing
(integer): Optional. The bottom border size in pixels. Used on all the child components.postCreate
(fun(self: mwseMCMMouseBinder)): Optional. Can define a custom formatting function to make adjustments to any element saved inself.elements
.class
(string): Optional.componentType
(string): Optional.parentComponent
(mwseMCMComponent): Optional.
Returns:
button
(mwseMCMMouseBinder)
press
⚓︎
Shows the rebind prompt popup. The popup is active until some valid input is given.
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.
resetToDefault
⚓︎
This method will reset the variable.value
to the default value.
myObject:resetToDefault()
setText
⚓︎
Sets the text on the mwseMCMButton's button UI Element.
myObject:setText(newText)
Parameters:
newText
(string)
setVariableValue
⚓︎
Changes the Setting's variable.value
to the given value, updates the Setting's label and widget if needed, and calls self:update
.
myObject:setVariableValue(newValue)
Parameters:
newValue
(unknown)
update
⚓︎
Sets the button UI element text to self.buttonText
. Calls the Button's callback method and if restartRequired
is set to true, notifies the player to restart the game.
myObject:update()
updatePopupLabel
⚓︎
Updates the label that shows currently bound key combination in the rebind popup to the given combination.
local updated = myObject:updatePopupLabel(keyCombo)
Parameters:
keyCombo
(mwseKeyMouseCombo)
Returns:
updated
(boolean)