View Single Post
05/10/14, 06:22 PM   #5
Kentarii
AddOn Author - Click to view addons
Join Date: Apr 2014
Posts: 42
This works for me to hide my windows when entering menus, dialogues and whatnot..

In init/onload method:
Lua Code:
  1. ZO_PreHookHandler(ZO_GameMenu_InGame, "OnShow", function()
  2.         self:HideIfVisible()
  3.     end)
  4.     ZO_PreHookHandler(ZO_GameMenu_InGame, "OnHide", function()
  5.         self:ShowIfVisible()
  6.     end)
  7.     ZO_PreHookHandler(ZO_InteractWindow, "OnShow", function()
  8.         self:HideIfVisible()
  9.     end)
  10.     ZO_PreHookHandler(ZO_InteractWindow, "OnHide", function()
  11.         self:ShowIfVisible()
  12.     end)
  13.     ZO_PreHookHandler(ZO_KeybindStripControl, "OnShow", function()
  14.         self:HideIfVisible()
  15.     end)
  16.     ZO_PreHookHandler(ZO_KeybindStripControl, "OnHide", function()
  17.         self:ShowIfVisible()
  18.     end)
  19.     ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnShow", function()
  20.         self:HideIfVisible()
  21.     end)
  22.     ZO_PreHookHandler(ZO_MainMenuCategoryBar, "OnHide", function()
  23.         self:ShowIfVisible()
  24.     end)
(Don't remember anymore in which addon I saw these prehooks handlers first.)

Lua Code:
  1. --- Hide the window if visible and screen state changed to some dialogue/menu interface.
  2. -- @return void
  3. function module:HideIfVisible()
  4.     if self.vars.visible then
  5.         HoWUI_QuestJournal:SetHidden(true)
  6.     end
  7. end
  8.  
  9. --- Show the window if visible and screen state returned to normal.
  10. -- @return void
  11. function module:ShowIfVisible()
  12.     if self.vars.visible then
  13.         HoWUI_QuestJournal:SetHidden(false)
  14.     end
  15. 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.
  Reply With Quote