summaryrefslogtreecommitdiff
path: root/xmake/core/ui/view.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/ui/view.lua')
-rw-r--r--xmake/core/ui/view.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/xmake/core/ui/view.lua b/xmake/core/ui/view.lua
index de301e795..00c27132a 100644
--- a/xmake/core/ui/view.lua
+++ b/xmake/core/ui/view.lua
@@ -232,8 +232,19 @@ function view:resize()
end
-- show view?
-function view:show(visible)
+--
+-- .e.g
+-- v:show(false)
+-- v:show(true, {focused = true})
+--
+function view:show(visible, opt)
if self:state("visible") ~= visible then
+ local parent = self:parent()
+ if parent and parent:current() == self and not visible then
+ parent:select_next(nil, true)
+ elseif parent and visible and opt and opt.focused then
+ parent:select(self)
+ end
self:state_set("visible", visible)
self:invalidate()
end