Справочник › Справочник функций › Conditions

Conditions.bossmod.idEditor

зависимость

Как вызывать

Conditions.bossmod.idEditor(parent, label, current, changed)

Запишите зависимость Conditions.bossmod.idEditor и вызывайте её по этому имени. Вызов через пространство имён не передаёт self: используйте вызов через двоеточие или передайте объект сами.

Что делает

Builds a full-width edit box for an optional boss-mod ID (such as the encounter ID) and adds it to parent. On Enter it passes the typed number to changed only when validID accepts it, otherwise nil, and rewrites the box to the accepted ID or blank.

Аргументы

ИмяТипЧто делает
parenttableCondition widget group the control is added to.
labelstringLabel shown above the edit box.
currentnumber | nilSaved ID to display; nil shows an empty box.
changedfunctionCalled with the accepted positive whole-number ID, or nil when the text is blank or invalid.

Возвращает

1RMConditionInputThe edit box, already added to parent.

Издания

Встроенные помощники регистрируются во всех изданиях. Различается игровой API, который они читают; если нужного API нет, помощник использует запасной вариант или возвращает nil с причиной.

Не читает игровой API напрямую.

Как его вызывает аддон

Зависимости

Исходный код

Conditions/bossmod.lua, строка 70. В игре только для чтения; «Дублировать» создаёт редактируемую копию.

Conditions.bossmod.idEditor(parent, label, current, changed)
    local edit = addon:CreateConditionEditBox()
    edit:SetFullWidth(true)
    edit:SetLabel(label)
    edit:SetText(current and tostring(current) or "")
    edit:SetCallback("OnEnterPressed", function(_, _, text)
        local id = tonumber(text)
        changed(validID(id) and id or nil)
        edit:SetText(validID(id) and tostring(id) or "")
    end)
    parent:AddChild(edit)
    return edit

Назад: Справочник функций