diff --git a/graphics/element.lua b/graphics/element.lua index f75b79c..2cfcc93 100644 --- a/graphics/element.lua +++ b/graphics/element.lua @@ -370,10 +370,6 @@ function element.new(args, constraint, child_offset_x, child_offset_y) ---@param ... any value(s) function protected.on_update(...) end - -- callback on control press responses - ---@param result any - function protected.response_callback(result) end - --#endregion --#region Accessors and Control -- @@ -793,10 +789,6 @@ function element.new(args, constraint, child_offset_x, child_offset_y) ---@param ... any new data function public.update(...) protected.on_update(...) end - -- on a control request response - ---@param result any - function public.on_response(result) protected.response_callback(result) end - -- register a callback with a PSIL, allowing for automatic unregister on delete
-- do not use graphics elements directly with PSIL subscribe() ---@param ps psil PSIL to subscribe to diff --git a/graphics/elements/controls/HazardButton.lua b/graphics/elements/controls/HazardButton.lua index 002c7fd..7815ba3 100644 --- a/graphics/elements/controls/HazardButton.lua +++ b/graphics/elements/controls/HazardButton.lua @@ -159,13 +159,6 @@ return function (args) end end - -- callback on request response - ---@param result boolean true for success, false for failure - function e.response_callback(result) - tcd.abort(on_timeout) - if result then on_success() else on_failure(0) end - end - -- set the value (true simulates pressing the button) ---@param val boolean new value function e.set_value(val) @@ -201,5 +194,12 @@ return function (args) ---@class HazardButton:graphics_element local HazardButton, id = e.complete(true) + -- callback for request response + ---@param success boolean + function HazardButton.on_response(success) + tcd.abort(on_timeout) + if success then on_success() else on_failure(0) end + end + return HazardButton, id end