Thread Tools Display Modes
05/26/14, 04:39 PM   #1
hulksmash
 
hulksmash's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 30
bring to front

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
  Reply With Quote
05/26/14, 04:55 PM   #2
Garkin
 
Garkin's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2014
Posts: 832
Originally Posted by hulksmash View Post
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.
As far as I know, if you want to have window on the top of other you should use higher draw layer, not lower.

And this two methods might help you as well:
Lua Code:
  1. window:SetTopmost()
  2. window:BringWindowToTop()
http://wiki.esoui.com/Controls#TopLevelWindow
  Reply With Quote
05/27/14, 10:46 AM   #3
hulksmash
 
hulksmash's Avatar
AddOn Author - Click to view addons
Join Date: May 2014
Posts: 30
Originally Posted by Garkin View Post

And this two methods might help you as well:
Lua Code:
  1. window:SetTopmost()
  2. window:BringWindowToTop()
http://wiki.esoui.com/Controls#TopLevelWindow


OMG how did I not see those? Very helpful, thank you
  Reply With Quote
05/27/14, 01:46 PM   #4
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
AddOn Author - Click to view addons
Join Date: Feb 2014
Posts: 648
I had somehow missed those methods as well.
  Reply With Quote

ESOUI » Developer Discussions » Lua/XML Help » bring to front


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off