restore clearText binding, don't display menu if its empty

This commit is contained in:
Eduardo Bart 2012-01-04 09:29:59 -02:00
parent 1c4bbfb7f3
commit 215d426b42
2 changed files with 7 additions and 0 deletions

View File

@ -9,6 +9,12 @@ function UIPopupMenu.create()
end
function UIPopupMenu:display(pos)
-- don't display if not options was added
if self:getChildCount() == 0 then
self:destroy()
return
end
displayUI(self, {x = pos.x, y = pos.y})
self:bindRectToParent()
self:grabMouse()

View File

@ -85,6 +85,7 @@ void Application::registerLuaFunctions()
g_lua.bindClassMemberFunction<UIWidget>("ungrabMouse", &UIWidget::ungrabMouse);
g_lua.bindClassMemberFunction<UIWidget>("grabKeyboard", &UIWidget::grabKeyboard);
g_lua.bindClassMemberFunction<UIWidget>("ungrabKeyboard", &UIWidget::ungrabKeyboard);
g_lua.bindClassMemberFunction<UIWidget>("clearText", &UIWidget::clearText);
g_lua.bindClassMemberFunction<UIWidget>("isActive", &UIWidget::isActive);
g_lua.bindClassMemberFunction<UIWidget>("isEnabled", &UIWidget::isEnabled);
g_lua.bindClassMemberFunction<UIWidget>("isDisabled", &UIWidget::isDisabled);