diff --git a/modules/corelib/ui/uispinbox.lua b/modules/corelib/ui/uispinbox.lua index 5bdd51ec..6b0c24c9 100644 --- a/modules/corelib/ui/uispinbox.lua +++ b/modules/corelib/ui/uispinbox.lua @@ -4,6 +4,7 @@ UISpinBox = extends(UITextEdit) function UISpinBox.create() local spinbox = UISpinBox.internalCreate() spinbox:setValidCharacters('0123456789') + spinbox.displayButtons = true spinbox.minimum = 0 spinbox.maximum = 0 spinbox.value = 0 @@ -50,15 +51,33 @@ end function UISpinBox:onStyleApply(styleName, styleNode) for name, value in pairs(styleNode) do if name == 'maximum' then - addEvent(function() self:setMaximum(value) - end) + addEvent(function() self:setMaximum(value) end) elseif name == 'minimum' then - addEvent(function() self:setMinimum(value) - end) + addEvent(function() self:setMinimum(value) end) + elseif name == 'buttons' then + addEvent(function() + if value then + self:showButtons() + else + self:hideButtons() + end + end) end end end +function UISpinBox:showButtons() + self:getChildById('up'):show() + self:getChildById('down'):show() + self.displayButtons = true +end + +function UISpinBox:hideButtons() + self:getChildById('up'):hide() + self:getChildById('down'):hide() + self.displayButtons = false +end + function UISpinBox:up() self:setValue(self.value + 1) end diff --git a/modules/game_market/ui/marketoffers.otui b/modules/game_market/ui/marketoffers.otui index a3638da9..a3e6bdde 100644 --- a/modules/game_market/ui/marketoffers.otui +++ b/modules/game_market/ui/marketoffers.otui @@ -149,6 +149,7 @@ Panel anchors.left: prev.right margin-left: 3 width: 55 + buttons: false minimum: 1 maximum: 64000