[Orxonox-commit 3234] r7925 - code/branches/usability/data/gui/scripts
landauf at orxonox.net
landauf at orxonox.net
Sun Feb 20 01:22:26 CET 2011
Author: landauf
Date: 2011-02-20 01:22:25 +0100 (Sun, 20 Feb 2011)
New Revision: 7925
Modified:
code/branches/usability/data/gui/scripts/GUISheet.lua
code/branches/usability/data/gui/scripts/SheetManager.lua
Log:
if a menu sheet was opened with the keyboard, preselect the first button
Modified: code/branches/usability/data/gui/scripts/GUISheet.lua
===================================================================
--- code/branches/usability/data/gui/scripts/GUISheet.lua 2011-02-20 00:10:38 UTC (rev 7924)
+++ code/branches/usability/data/gui/scripts/GUISheet.lua 2011-02-20 00:22:25 UTC (rev 7925)
@@ -139,7 +139,9 @@
-- Presses the selected button if any
function P:pressSelectedButton()
if self:hasSelection() then
+ self.pressedEnter = true
self:getSelectedButton().callback()
+ self.pressedEnter = false
end
end
Modified: code/branches/usability/data/gui/scripts/SheetManager.lua
===================================================================
--- code/branches/usability/data/gui/scripts/SheetManager.lua 2011-02-20 00:10:38 UTC (rev 7924)
+++ code/branches/usability/data/gui/scripts/SheetManager.lua 2011-02-20 00:22:25 UTC (rev 7925)
@@ -120,15 +120,22 @@
end
-- Hide all previous sheets if necessary
+ local previous
if bHidePrevious then
for i = 1, activeMenuSheets.size - 1 do
- activeMenuSheets[i].sheet:hide()
+ previous = activeMenuSheets[i].sheet
+ previous:hide()
end
end
menuSheet:show()
menuSheetsRoot:activate()
+ -- select first button if the menu was opened with the keyboard
+ if previous and previous.pressedEnter and menuSheet.buttons and menuSheet:hasSelection() == false then
+ menuSheet:moveSelection(1, 0)
+ end
+
return menuSheet
end
More information about the Orxonox-commit
mailing list