Hi,
I’ve created a module with LUA script but I can’t figure out, how can I call a function when a slider widget changed by a user?
I’ve tried with clicked_callback and changed_callback but in this way the scipt failed to load.
local cropSlider = dt.new_widget("slider")
{
label = _("Max crop select"),
soft_min = 0, -- The soft minimum value for the slider, the slider can't go beyond this point
soft_max = 10, -- The soft maximum value for the slider, the slider can't go beyond this point
hard_min = 0, -- The hard minimum value for the slider, the user can't manually enter a value beyond this point
hard_max = 100, -- The hard maximum value for the slider, the user can't manually enter a value beyond this point
value = 1, -- The current value of the slider
changed_callback = function (this)
-- do something
end
}
local function do_something()
dt.print("did something")
end
local cropSlider = dt.new_widget("slider")
{
label = _("Max crop select"),
soft_min = 0, -- The soft minimum value for the slider, the slider can't go beyond this point
soft_max = 10, -- The soft maximum value for the slider, the slider can't go beyond this point
hard_min = 0, -- The hard minimum value for the slider, the user can't manually enter a value beyond this point
hard_max = 100, -- The hard maximum value for the slider, the user can't manually enter a value beyond this point
value = 1, -- The current value of the slider
changed_callback = function (this)
-- do something
do_something()
end
}