SpinWidget in Dispatcher fix (#8558)

Enable SpinWidget OK button in dispatcher for unchanged value.
reviewable/pr8555/r2
hius07 2 years ago committed by GitHub
parent a703b213f7
commit d4eecd9f00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -523,6 +523,7 @@ function Dispatcher:addItem(caller, menu, location, settings, section)
value_max = settingsList[k].max,
default_value = settingsList[k].default,
title_text = Dispatcher:getNameFromItem(k, location, settings),
ok_always_enabled = true,
callback = function(spin)
if location[settings] == nil then
location[settings] = {}
@ -570,6 +571,7 @@ function Dispatcher:addItem(caller, menu, location, settings, section)
default_value = 0,
title_text = Dispatcher:getNameFromItem(k, location, settings),
info_text = _([[If called by a gesture the amount of the gesture will be used]]),
ok_always_enabled = true,
callback = function(spin)
if location[settings] == nil then
location[settings] = {}

@ -39,6 +39,7 @@ local SpinWidget = InputContainer:new{
wrap = false,
cancel_text = _("Close"),
ok_text = _("Apply"),
ok_always_enabled = false, -- set to true to enable OK button for unchanged value
cancel_callback = nil,
callback = nil,
close_callback = nil,
@ -165,7 +166,7 @@ function SpinWidget:update(numberpicker_value, numberpicker_value_index)
},
{
text = self.ok_text,
enabled = self.original_value ~= value_widget:getValue(),
enabled = self.ok_always_enabled or self.original_value ~= value_widget:getValue(),
callback = function()
self.value, self.value_index = value_widget:getValue()
self.original_value = self.value

Loading…
Cancel
Save