ui: a Slider answers SetEnabled, because OpenMap's options tab called it unguarded

Rendering a panel is not the same as it working. OpenMap's options menu
opens 500x500 with 104 frames and 49 placed labels, and its Look tab
died on click: Map/Panel.lua:1084, attempt to call method SetEnabled (a
nil value) -- so a third of its options was unreachable.

SetEnabled is already composed here for Button, CheckButton, EditBox and
LootButton, and was deliberately withheld from a Slider, because addons
duck-type on the enabled family to tell a control from a bar. What they
duck-type on is the TRIO (if widget.IsEnabled then), that is what
tests/slider.rs pins, and the trio is still absent; SetEnabled is beyond
1.12 by construction, so a Slider answering it invents no 1.12
behaviour. OpenMapClassic calls it unguarded on every options row with a
condition, which is what settles it.

On a Slider it writes the mouse -- input refused, art not greyed, which
1.12 has no slot for; the caller dims it itself on the next line. The
argument goes through GetBoolOrDefault, not Lua truthiness, because
DoiteAuras writes SetEnabled(ok and 1 or 0) and 0 is truthy in Lua.

Also records a count that was wrong until checked: grep says 39 calls
across five addons, but AdvancedTradeSkillWindow2 and SoftSpoken define
their own SetEnabled and SoftSpoken's slider row is fully guarded. The
real unguarded widget calls are OpenMap's three and DoiteAuras' two --
and SoftSpoken's blank settings page is NOT this, and is still open.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SgstFWtn1RxEJ5kVrpgYwn
This commit is contained in:
2026-11-03 19:34:52 -07:00
co-authored by Claude Opus 5
parent c3a0315985
commit b7a8e1c406
4 changed files with 104 additions and 7 deletions
+41
View File
@@ -3088,3 +3088,44 @@ number — it swallows the sheet's own torn frame and decorative corner, because
busy right out to its border where Orgrimmar's is mostly blank parchment. A 0.58 hull shipped as
if it were a trace would be a guess wearing an artist's clothes. The feather claims nothing it
cannot show.
## A third of OpenMap's options raised on open
"Are the buttons and options actually working?" is a different question from "do they render",
and the answer was no. Rendering them was never enough to tell: `OpenMapMenu` opens 500x500 with
104 frames and 49 placed labels, and the **Look** tab still died on click:
```
Map/Panel.lua:1084: attempt to call method `SetEnabled' (a nil value)
```
`SetEnabled` is the later-era replacement for 1.12's `Enable`/`Disable` pair and this client
already composes it — on **Button, CheckButton, EditBox and LootButton**. It was deliberately
withheld from a **Slider**, and the reason is written down in `widget_surface.rs`: addons
duck-type on the enabled family to tell a control from a bar.
The reason doesn't survive contact with the call. What addons duck-type on is the *trio*
(`if widget.IsEnabled then`), that is what `tests/slider.rs` pins, and the trio is still absent —
`SetEnabled` is beyond 1.12 by construction, so putting it on a Slider invents no 1.12 behaviour.
What forces it is that OpenMapClassic calls it **unguarded**, on every options row that carries a
condition, so a nil method took the whole tab with it.
On a Slider it writes the mouse: input refused, art **not** greyed, which 1.12 has no slot for —
the caller dims it itself on the line below (`f:SetAlpha(on and 1 or 0.5)`). The argument goes
through `GetBoolOrDefault` rather than Lua truthiness, because DoiteAuras writes
`SetEnabled(ok and 1 or 0)` (`Modules/DoiteEdit.lua:6246`) and **0 is truthy in Lua** — read that
way, every control the caller meant to switch off would come back on.
Both options tabs now open and are complete, sliders and all — Deepest zoom, Icons from, Map size,
Minimap detail from, strength and opacity, each with a thumb, which is the slider-thumb fix
earlier in this file arriving somewhere visible.
### A count that was wrong until it was checked
`grep -c "SetEnabled("` over the addon folder answers **39, across five addons**, and that number
is useless: AdvancedTradeSkillWindow2 and SoftSpoken define *their own* `SetEnabled` — a local
function in one, a module method in the other — and SoftSpoken's slider row is fully guarded
(`if slider.SetEnabled then … elseif slider.Enable … elseif slider.EnableMouse`). The real
unguarded widget calls are OpenMapClassic's three and DoiteAuras' two. It was briefly written down
here that this was also the cause of SoftSpoken's blank settings page. It is not, and that page is
still open.