WoW:Make Frames Closable With the "Esc" Key: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 1: Line 1:
==How To==
To make your main frame closable with the ESCape key go into the OnLoad function and add the following line :
To make your main frame closable with the ESCape key go into the OnLoad function and add the following line :


Line 32: Line 31:
the OnShow and OnHide parts will play the usual sound that's played when you open/close blizzards frames - e.g. your character frame
the OnShow and OnHide parts will play the usual sound that's played when you open/close blizzards frames - e.g. your character frame


 
== EditBoxes and OnEscapePressed ==
 
EditBox type frames have an "OnEscapePressed" handler, which will prevent this method from working with them.  For these frames you can instead use:
==note==
   myeditboxframe:SetScript("OnEscapePressed", function(self) self:Hide() end)
This does not work for me.  Not even a little bit.  What I found *does* work is this simple bit of code added to any frame (in this example, 'testframe')
 
 
  testeditbox = CreateFrame("EditBox",nil,testframe,"InputBoxTemplate")
   testeditbox:SetScript("OnEscapePressed",function()
    testframe:Hide()
  end)
 
 


[[Category: HOWTOs|Make frames closable with the ESCape key]]
[[Category: HOWTOs|Make frames closable with the ESCape key]]
Anonymous user