diff options
| author | ruki <[email protected]> | 2020-12-01 00:34:10 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-12-01 00:34:10 +0800 |
| commit | 15c4701dd679316802d67d02b2b1c2dd302145bc (patch) | |
| tree | b38c3029e2bd3987ea30093e9f6d3800de39fa93 /xmake/core | |
| parent | 73fa95c6caf7600274febaca2018261d7960c546 (diff) | |
add page down and up events
Diffstat (limited to 'xmake/core')
| -rw-r--r-- | xmake/core/ui/choicebox.lua | 5 | ||||
| -rw-r--r-- | xmake/core/ui/menuconf.lua | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/xmake/core/ui/choicebox.lua b/xmake/core/ui/choicebox.lua index 72964e4d0..f53f53d0f 100644 --- a/xmake/core/ui/choicebox.lua +++ b/xmake/core/ui/choicebox.lua @@ -160,6 +160,11 @@ function choicebox:on_event(e) end self:_notify_scrolled() return true + elseif e.key_name == "PageDown" or e.key_name == "PageUp" then + local direction = e.key_name == "PageDown" and 1 or -1 + self:scroll(self:height() * direction) + self:_notify_scrolled() + return true elseif e.key_name == "Enter" or e.key_name == " " then self:_do_select() return true diff --git a/xmake/core/ui/menuconf.lua b/xmake/core/ui/menuconf.lua index 05e7a65f0..f0b128fc2 100644 --- a/xmake/core/ui/menuconf.lua +++ b/xmake/core/ui/menuconf.lua @@ -175,6 +175,11 @@ function menuconf:on_event(e) end self:_notify_scrolled() return true + elseif e.key_name == "PageDown" or e.key_name == "PageUp" then + local direction = e.key_name == "PageDown" and 1 or -1 + self:scroll(self:height() * direction) + self:_notify_scrolled() + return true elseif e.key_name == "Enter" or e.key_name == " " then self:_do_select() return true |
