This works for me to hide my windows when entering menus, dialogues and whatnot..
In init/onload method:
Lua Code:
ZO_PreHookHandler(ZO_GameMenu_InGame, "OnShow", function()
self:HideIfVisible()
end)
ZO_PreHookHandler(ZO_GameMenu_InGame, "OnHide", function()
self:ShowIfVisible()
end)
ZO_PreHookHandler(ZO_InteractWindow, "OnShow", function()
self:HideIfVisible()
end)
ZO_PreHookHandler(ZO_InteractWindow, "OnHide", function()
self:ShowIfVisible()
end)
ZO_PreHookHandler(ZO_KeybindStripControl, "OnShow", function()
self:HideIfVisible()
end)
ZO_PreHookHandler(ZO_KeybindStripControl, "OnHide", function()
self:ShowIfVisible()
end)
ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnShow", function()
self:HideIfVisible()
end)
ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnHide", function()
self:ShowIfVisible()
end)
(Don't remember anymore in which addon I saw these prehooks handlers first.)
Lua Code:
--- Hide the window if visible and screen state changed to some dialogue/menu interface.
-- @return void
function module:HideIfVisible()
if self.vars.visible then
HoWUI_QuestJournal:SetHidden(true)
end
end
--- Show the window if visible and screen state returned to normal.
-- @return void
function module:ShowIfVisible()
if self.vars.visible then
HoWUI_QuestJournal:SetHidden(false)
end
end
HoWUI_QuestJournal is my TopLevelWindow.
self.vars.visible is a SV i use to keep track of if window should be visible or not afterwards.