Implement #261
This commit is contained in:
parent
e7012031eb
commit
469df27d9b
|
@ -118,6 +118,10 @@ function UISpinBox:setValue(value)
|
|||
signalcall(self.onValueChange, self, value)
|
||||
end
|
||||
|
||||
function UISpinBox:getValue()
|
||||
return self.value
|
||||
end
|
||||
|
||||
function UISpinBox:setMinimum(minimum)
|
||||
minimum = minimum or -9223372036854775808
|
||||
self.minimum = minimum
|
||||
|
@ -129,6 +133,10 @@ function UISpinBox:setMinimum(minimum)
|
|||
end
|
||||
end
|
||||
|
||||
function UISpinBox:getMinimum()
|
||||
return self.minimum
|
||||
end
|
||||
|
||||
function UISpinBox:setMaximum(maximum)
|
||||
maximum = maximum or 9223372036854775807
|
||||
self.maximum = maximum
|
||||
|
@ -137,10 +145,10 @@ function UISpinBox:setMaximum(maximum)
|
|||
end
|
||||
end
|
||||
|
||||
function UISpinBox:getMaximum()
|
||||
return self.maximum
|
||||
end
|
||||
|
||||
function UISpinBox:setStep(step)
|
||||
self.step = step or 1
|
||||
end
|
||||
|
||||
function UISpinBox:getValue()
|
||||
return self.value
|
||||
end
|
||||
|
|
|
@ -591,12 +591,24 @@ function moveStackableItem(item, toPos)
|
|||
spinbox:setValue(0)
|
||||
spinbox:hideButtons()
|
||||
spinbox:focus()
|
||||
spinbox.firstEdit = true
|
||||
|
||||
local spinBoxValueChange = function(self, value)
|
||||
scrollbar:setValue(value)
|
||||
end
|
||||
spinbox.onValueChange = spinBoxValueChange
|
||||
|
||||
local check = function()
|
||||
if spinbox.firstEdit then
|
||||
spinbox:setValue(spinbox:getMaximum())
|
||||
spinbox.firstEdit = false
|
||||
end
|
||||
end
|
||||
g_keyboard.bindKeyPress("Up", function() check() spinbox:up() end, spinbox)
|
||||
g_keyboard.bindKeyPress("Down", function() check() spinbox:down() end, spinbox)
|
||||
g_keyboard.bindKeyPress("PageUp", function() check() spinbox:setValue(spinbox:getValue()+10) end, spinbox)
|
||||
g_keyboard.bindKeyPress("PageDown", function() check() spinbox:setValue(spinbox:getValue()-10) end, spinbox)
|
||||
|
||||
scrollbar.onValueChange = function(self, value)
|
||||
itembox:setItemCount(value)
|
||||
spinbox.onValueChange = nil
|
||||
|
|
Loading…
Reference in New Issue