Some flexibility changes

This commit is contained in:
Henrique Santiago
2012-08-27 04:47:08 -03:00
parent e5df872600
commit 5a367cfe27
4 changed files with 31 additions and 5 deletions

View File

@@ -48,6 +48,20 @@ function UIComboBox:addOption(text, data)
return index
end
function UIComboBox:removeOption(text)
for i,v in ipairs(self.options) do
if v.text == text then
table.remove(self.options, i)
if self.currentIndex == i then
self:setCurrentIndex(1)
elseif self.currentIndex > i then
self.currentIndex = self.currentIndex - 1
end
return
end
end
end
function UIComboBox:onMousePress(mousePos, mouseButton)
local menu = g_ui.createWidget(self:getStyleName() .. 'PopupMenu')
menu:setId(self:getId() .. 'PopupMenu')