diff options
| author | ruki <[email protected]> | 2017-12-20 23:20:43 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-12-20 14:04:19 +0800 |
| commit | bf0ea773b29ca4a85430dcb5ab024ed27a8eeb0c (patch) | |
| tree | f21820ed08d80213c1049b50e1b99b07bc19f627 /xmake/core/ui/group.lua | |
| parent | 5924ef4adbe4b084c465bc9604254be60d147074 (diff) | |
fix on event for ui
Diffstat (limited to 'xmake/core/ui/group.lua')
| -rw-r--r-- | xmake/core/ui/group.lua | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/xmake/core/ui/group.lua b/xmake/core/ui/group.lua index a088ef7af..06f2a1864 100644 --- a/xmake/core/ui/group.lua +++ b/xmake/core/ui/group.lua @@ -183,9 +183,9 @@ function group:select(v) -- undo the current view first if self:state("focused") then - current:state_set('focused', false) + current:state_set("focused", false) end - current:state_set('selected', false) + current:state_set("selected", false) end -- update the current selected view @@ -241,9 +241,20 @@ function group:select_next(forward, start) end end --- do event -function group:do_event(e) - -- TODO +-- on event +function group:event_on(e) + + -- is empty views? + if self:empty() then + return + end + + -- send event to all child views + for v in self:views() do + if v:event_need(e) then + v:event_on(e) + end + end end -- execute group @@ -266,11 +277,11 @@ function group:execute() -- do event if e then - self:do_event(e) + self:event_on(e) sleep = false else -- do idle event - app:do_event(event.idle()) + app:event_on(event.idle()) end -- wait some time, 50ms |
