How to use editBox with numeric input only

From ESOUI Wiki

Jump to: navigation, search

EditControl has methods AddValidCharacter(string) (probably only one character per call)
and RemoveAllValidCharacters(). For common filters there's SetTextType(integer):

h5. TextType
* TEXT_TYPE_ALL
* TEXT_TYPE_ALPHABETIC
* TEXT_TYPE_NUMERIC
* TEXT_TYPE_NUMERIC_UNSIGNED_INT
* TEXT_TYPE_PASSWORD

XML attribute is textType, e.g. textType="NUMERIC_UNSIGNED_INT"

local editControl = WINDOW_MANAGER:CreateControl("MyAddonsEditBox1", myParentControl, CT_EDITBOX)
...
editControl:SetColor(DEFAULT_EDIT_BOX_ENABLED_COLOR:UnpackRGBA())
editControl:SetTextType(TEXT_TYPE_NUMERIC_UNSIGNED_INT)

XML example for an EditBox with numeric textType

<Backdrop name="$(parent)ThresholdAmount" tier="HIGH" inherits="ZO_SingleLineEditBackdrop_Keyboard">
  <Dimensions x="80" />
  <Anchor point="TOPLEFT" relativeTo="$(parent)ItemLink" relativePoint="BOTTOMLEFT" offsetY="10" />
  <Controls>
    <EditBox name="$(parent)ThresholdAmountText" textType="NUMERIC" inherits="ZO_DefaultEditForBackdrop ZO_EditDefaultText" maxInputCharacters="6"/>
  </Controls>
</Backdrop>

For more EditBox parameters see https://wiki.esoui.com/UI_XML#EditBox.

Personal tools
Namespaces
Variants
Actions
Menu
Wiki
Toolbox