fix combobox

This commit is contained in:
Eduardo Bart 2012-03-29 17:21:59 -03:00
parent a475384b73
commit 6ace984440
2 changed files with 4 additions and 2 deletions

View File

@ -36,7 +36,8 @@ function UIComboBox:addOption(text, data)
end end
function UIComboBox:onMousePress(mousePos, mouseButton) function UIComboBox:onMousePress(mousePos, mouseButton)
local menu = createWidget(self:getStyleName() .. 'PopupMenu', self) local menu = createWidget(self:getStyleName() .. 'PopupMenu')
menu:setId(self:getId() .. 'PopupMenu')
for i,v in ipairs(self.options) do for i,v in ipairs(self.options) do
menu:addOption(v.text, function() self:setCurrentOption(v.text) end) menu:addOption(v.text, function() self:setCurrentOption(v.text) end)
end end

View File

@ -92,7 +92,8 @@ void UIManager::inputEvent(const InputEvent& event)
if(UIWidgetPtr parent = widget->getParent()) if(UIWidgetPtr parent = widget->getParent())
parent->focusChild(widget, Fw::MouseFocusReason); parent->focusChild(widget, Fw::MouseFocusReason);
} }
widget->onMousePress(event.mousePos, event.mouseButton); if(widget->onMousePress(event.mousePos, event.mouseButton))
break;
} }
break; break;