auto resize menu width

This commit is contained in:
Eduardo Bart
2012-01-04 09:24:29 -02:00
parent b8150d160e
commit 1c4bbfb7f3
7 changed files with 25 additions and 4 deletions

View File

@@ -23,6 +23,8 @@ function UIPopupMenu:addOption(optionName, optionCallback)
self:destroy()
end
optionWidget:setText(optionName)
local width = optionWidget:getTextSize().width + optionWidget:getMarginLeft() + optionWidget:getMarginRight() + 6
self:setWidth(math.max(self:getWidth(), width))
end
function UIPopupMenu:addSeparator()