Appel
Conditions.bossmod.idEditor(parent, label, current, changed)
Enregistrez la dépendance Conditions.bossmod.idEditor, puis appelez-la sous ce nom. Un appel par espace de noms ne transmet pas self : utilisez un appel avec deux-points ou passez l'objet vous-même.
Ce qu'elle fait
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.
Arguments
| Nom | Type | Ce qu'elle fait |
|---|---|---|
parent | table | Condition widget group the control is added to. |
label | string | Label shown above the edit box. |
current | number | nil | Saved ID to display; nil shows an empty box. |
changed | function | Called with the accepted positive whole-number ID, or nil when the text is blank or invalid. |
Retours
| 1 | RMConditionInput | The edit box, already added to parent. |
|---|
Éditions
Les fonctions utilitaires intégrées sont enregistrées sur toutes les éditions. Ce qui diffère, c'est l'API du jeu qu'elles lisent ; quand l'une manque, la fonction utilitaire se rabat sur une alternative ou renvoie nil avec une raison.
Elle ne lit directement aucune API du jeu.
Comment l'addon l'appelle
- Rencontre (boss mod) (widget)
idEditor(parent, L["Encounter ID (blank for any)"], value.encounter, function(id) value.encounter = id; update() end) - Minuteur de boss mod (widget)
idEditor(parent, L["Boss ability spell ID"], value.spell, function(id)
Dépendances
validID→Conditions.bossmod.validID
Source
Conditions/bossmod.lua, ligne 70. En lecture seule dans le jeu ; Dupliquer crée une copie modifiable.
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