What is the best practice to bring a frame to the front on top of everything else? I have a button I made which after clicking its supposed to bring a modal to the front on top of everything else. I am using
:SetDrawLayer(0). It works correctly the first time but when I click on something behind it (specifically ZO_Skills window) and then click the open button again, it brings my window behind everything.
Code:
-- RENAME modal
ss.renameModal = Chain ( wm:CreateTopLevelWindow("ss.renameModal") )
:SetDimensions(450,200)
:SetAnchor(CENTER, GuiRoot, CENTER, 0, 0)
:SetHidden(true)
.__END
-- RENAME ICON
p[pfID].rename = Chain( wm:CreateControl("p"..pfID..".rename", p[pfID].btn, CT_BUTTON) )
:SetDimensions(30,30)
:SetNormalTexture("/esoui/art/buttons/edit_up.dds")
:SetAnchor(TOPRIGHT, p[pfID].btn, TOPLEFT, 0,0)
:SetDrawLayer(3)
:SetHandler("OnClicked",
function(self)
openRenameModal(pfID)
end)
.__END
Code:
function openRenameModal(pID)
ss.renameModal.currentPID = pID
ss.renameModal:SetHidden(false)
ss.renameModal.editBox:TakeFocus()
--this doesnt always bring to front
ss.renameModal.bg:SetDrawLayer( 0 )
debug = ss.renameModal:GetDrawLayer()
d(debug)
end