Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7925 for code/branches


Ignore:
Timestamp:
Feb 20, 2011, 1:22:25 AM (14 years ago)
Author:
landauf
Message:

if a menu sheet was opened with the keyboard, preselect the first button

Location:
code/branches/usability/data/gui/scripts
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/usability/data/gui/scripts/GUISheet.lua

    r7922 r7925  
    140140function P:pressSelectedButton()
    141141    if self:hasSelection() then
     142        self.pressedEnter = true
    142143        self:getSelectedButton().callback()
     144        self.pressedEnter = false
    143145    end
    144146end
  • code/branches/usability/data/gui/scripts/SheetManager.lua

    r7922 r7925  
    121121
    122122    -- Hide all previous sheets if necessary
     123    local previous
    123124    if bHidePrevious then
    124125        for i = 1, activeMenuSheets.size - 1 do
    125             activeMenuSheets[i].sheet:hide()
     126            previous = activeMenuSheets[i].sheet
     127            previous:hide()
    126128        end
    127129    end
     
    129131    menuSheet:show()
    130132    menuSheetsRoot:activate()
     133
     134    -- select first button if the menu was opened with the keyboard
     135    if previous and previous.pressedEnter and menuSheet.buttons and menuSheet:hasSelection() == false then
     136        menuSheet:moveSelection(1, 0)
     137    end
    131138
    132139    return menuSheet
Note: See TracChangeset for help on using the changeset viewer.