fix: clear commands when no item in menu

This commit is contained in:
Qingping Hou
2012-03-29 21:16:09 +08:00
parent e94fe052d3
commit c89e3efc19

View File

@@ -210,6 +210,16 @@ function SelectMenu:addAllCommands()
end)
end
function SelectMenu:clearCommands()
self.commands = Commands:new{}
self.commands:add(KEY_BACK, nil, "",
"Exit menu",
function(sm)
return "break"
end)
end
------------------------------------------------
-- return the index of selected item
------------------------------------------------
@@ -244,6 +254,7 @@ function SelectMenu:choose(ypos, height)
renderUtf8Text(fb.bb, 30, y, cface, cfhash,
self.no_item_msg, true)
self.markerdirty = false
self:clearCommands()
else
local c
for c = 1, self.perpage do