diff options
| author | ruki <[email protected]> | 2018-01-25 22:32:19 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-01-25 09:13:54 +0800 |
| commit | 231320f8fc52bd03ab88f048a6e0efa027346c83 (patch) | |
| tree | d57ae0bddd4d446dae0e4f085f3966bdc5a35027 | |
| parent | 630c94df8a7b3b51a35c166c6a310a97c754989b (diff) | |
fix tab event for dialog
| -rw-r--r-- | xmake/core/ui/dialog.lua | 1 | ||||
| -rw-r--r-- | xmake/core/ui/menuconf.lua | 37 | ||||
| -rw-r--r-- | xmake/core/ui/window.lua | 2 |
3 files changed, 39 insertions, 1 deletions
diff --git a/xmake/core/ui/dialog.lua b/xmake/core/ui/dialog.lua index 90f252b10..37a19cebb 100644 --- a/xmake/core/ui/dialog.lua +++ b/xmake/core/ui/dialog.lua @@ -111,6 +111,7 @@ function dialog:event_on(e) self:quit() return true end + return window.event_on(self, e) end -- return module diff --git a/xmake/core/ui/menuconf.lua b/xmake/core/ui/menuconf.lua index 3e7e53af3..db34e4b99 100644 --- a/xmake/core/ui/menuconf.lua +++ b/xmake/core/ui/menuconf.lua @@ -39,6 +39,22 @@ function menuconf:init(name, bounds) -- init panel panel.init(self, name, bounds) + + -- init configs + self._CONFIGS = {} +end + +-- on event +function menuconf:event_on(e) + + -- select config + if e.type == event.ev_keyboard then + if e.key_name == "Down" then + return self:select_next() + elseif e.key_name == "Up" then + return self:select_prev() + end + end end -- insert a config item @@ -76,10 +92,31 @@ function menuconf:insert(config) -- insert this config item panel.insert(self, item) + -- select the first item + self:select(self:first()) + -- invalidate self:invalidate() end +-- load configs +function menuconf:load(configs) + + -- clear the views first + self:clear() + + -- save configs + self._CONFIGS = configs + + -- invalidate + self:invalidate() +end + +-- get configs +function menuconf:configs() + return self._CONFIGS +end + -- get text from the given config function menuconf:_text(config) diff --git a/xmake/core/ui/window.lua b/xmake/core/ui/window.lua index 158f3d3f3..2d10cd126 100644 --- a/xmake/core/ui/window.lua +++ b/xmake/core/ui/window.lua @@ -109,7 +109,7 @@ end -- on event function window:event_on(e) - + -- select panel? if e.type == event.ev_keyboard then if e.key_name == "Tab" then |
