Fix trade/use bug from previous commit

This commit is contained in:
Eduardo Bart 2013-01-30 18:57:37 -02:00
parent 5bf03c50d6
commit da050a5630
1 changed files with 2 additions and 1 deletions

View File

@ -58,8 +58,8 @@ function UIPopupMenu:addOption(optionName, optionCallback, shortcut)
local optionWidget = g_ui.createWidget(self:getStyleName() .. 'Button', self) local optionWidget = g_ui.createWidget(self:getStyleName() .. 'Button', self)
local lastOptionWidget = self:getLastChild() local lastOptionWidget = self:getLastChild()
optionWidget.onClick = function(self) optionWidget.onClick = function(self)
optionCallback()
self:getParent():destroy() self:getParent():destroy()
optionCallback()
end end
optionWidget:setText(optionName) optionWidget:setText(optionName)
local width = optionWidget:getTextSize().width + optionWidget:getMarginLeft() + optionWidget:getMarginRight() + 15 local width = optionWidget:getTextSize().width + optionWidget:getMarginLeft() + optionWidget:getMarginRight() + 15
@ -81,6 +81,7 @@ function UIPopupMenu:onDestroy()
if currentMenu == self then if currentMenu == self then
currentMenu = nil currentMenu = nil
end end
self:ungrabMouse()
end end
function UIPopupMenu:onMousePress(mousePos, mouseButton) function UIPopupMenu:onMousePress(mousePos, mouseButton)