How to show/hide window using the SCENE_MANAGER
All default controls in game UI are shown/hidden using the scene manager:

Create a simple scene fragment:
Lua Code:
  1. local fragment = ZO_SimpleSceneFragment:New(yourTopLevelWindow)
or scene fragment with fade in/out animation:
Lua Code:
  1. local fragment = ZO_FadeSceneFragment:New(yourTopLevelWindow)
or HUD scene fragment with fade in/out animation:
Lua Code:
  1. local fragment = ZO_HUDFadeSceneFragment:New(yourTopLevelWindow, showDuration, hideDuration)

And then add your fragment to all scenes where it has to be shown:
Lua Code:
  1. local scene = SCENE_MANAGER:GetScene("hud")
  2. scene:AddFragment(fragment)
If you want to add more fragments at once you can create fragment group:
Lua Code:
  1. local fragmentGroup = { fragment1, fragment2, fragment3 }
  2.  
  3. scene:AddFragmentGroup(fragmentGroup)
If you want to remove fragment from the scene use:
Lua Code:
  1. scene:RemoveFragment(fragment)

Another method is to show/hide fragments on demand in the current scene by calling:
(fragments are added to the scene just temporarily - until the scene is hidden)
Lua Code:
  1. SCENE_MANAGER:AddFragment(fragment)
  2. SCENE_MANAGER:RemoveFragment(fragment)
  3. SCENE_MANAGER:AddFragmentGroup(fragmentGroup)
  4. SCENE_MANAGER:RemoveFragmentGroup(fragmentGroup)

How to check which scene is currently active:
Code:
/script d(SCENE_MANAGER:GetCurrentScene():GetName())
Or you can look into the SCENE_MANAGER.scenes table, which contains reference to all registered scenes.



Example:
Lua Code:
  1. --simple window with a texture:
  2. local tlw, texture
  3. tlw = WINDOW_MANAGER:CreateTopLevelWindow()
  4. tlw:SetDimensions(100,100)
  5. tlw:SetAnchor(CENTER, GuiRoot, CENTER, 0, 0)
  6. tlw:SetHidden(true)
  7. texture = WINDOW_MANAGER:CreateControl(nil, tlw, CT_TEXTURE)
  8. texture:SetTexture("/esoui/art/icons/poi/poi_groupboss_complete.dds")
  9. texture:SetAnchorFill(tlw)
  10.  
  11. --create a scene fragment (1000ms show duration, 500ms hide duration)
  12. local fragment = ZO_HUDFadeSceneFragment:New(tlw, 1000, 500)
  13.  
  14. --add my fragment to scenes:
  15. HUD_SCENE:AddFragment(fragment)
  16. HUD_UI_SCENE:AddFragment(fragment)

Note:
In some cases you can break fast travel system if you add fade scene fragment to the "hud" scene (fast travel using the wayshrine costs money). If it happens, use ZO_HUDFadeSceneFragment or ZO_SimpleSceneFragment instead of ZO_FadeSceneFragment.