-
Notifications
You must be signed in to change notification settings - Fork 0
MenuRefresh
APHONIC edited this page Sep 15, 2026
·
2 revisions
MenuRefresh.lua: re-labels LAM2 controls whose name is a live function.
A LAM2 control whose name is a function only re-evaluates that function when LAM2 itself redraws the whole panel, not when your own code changes the underlying value (a live language switch, a value another control just set). This lets you force one control's label to re-read its function on demand.
Signature: returns { CollectFrom, Refresh }.
-
CollectFrom(build_data)scans your control list once at menu-build time for any checkbox/slider/button/dropdown with a functionname(recursing into submenus) and assigns each one areference. -
Refresh(control)re-reads and re-applies one control's current label text on demand.
local menu_refresher = LibAPH.CreateMenuLabelRefresher("MyAddon_MRC_", function() return MyAddon.lam_panel end)
menu_refresher.CollectFrom(build_data)
MyAddon.refresh_control_labels = menu_refresher.Refresh
-- call MyAddon.refresh_control_labels(control) whenever a live value backing a label changes