View Single Post
03/22/19, 12:50 PM   #2
Baertram
Super Moderator
 
Baertram's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 4,964
Do NOT put the fragment creation code into your toggle function or you will create a new fragment each time you press the keybind.
Just remove this from the function and put it below local sm = SCENE_MANAGER

local fragment = ZO_SimpleSceneFragment:New(window)
local scene = ZO_Scene:New(UAN.name, SM)
scene:AddFragment(fragment)

This will only create the fragment once.


Not sure why you need to define a new scene on your own.
local scene = ZO_Scene:New(UAN.name, SM)

Isn't it enough to use the existing HUD or HUD_UI scene?
Here is an example for a TOPLEVELCONTROL (your boxwindow control) added to a fragment which automatically hides with the UI (if inventory is shown e.g.) or shows with the UI (if inv., is closed e.g)

https://wiki.esoui.com/Scene_Manager:_On_scene_change

If you want to show the box control or hide it manually without the fragment taking care of it, you need to use SetHidden(true/false) on your toplevelcontrol as the toggle function is called.
But it will also added (in my example above) to the fragment of the hud_Scene and thus be shown/hidden with the HUD_SCENE through the base game.

Last edited by Baertram : 03/22/19 at 12:56 PM.
  Reply With Quote