Talk:Make frames closable with the Escape key


 * Thanks for the article but I'm having a problem extending the code for use with a window that includes an EditBox. I'm using it in conjunction with "myEditBox:SetAutoFocus( false );". It works fine until I click in one of the window's EditBoxes. After that the Escape key no longer closes the window. I've tried adding "autofocus="false"" to the EditBox code but with no luck so far. Has anyone else had any success with a similar issue? Thanks. Belleboom 16:32, 14 September 2007 (UTC)Belleboom


 * In answer to the above question: when you create the editbox, call

myEditBox:SetAutoFocus( false );
 * Then in the "OnEscapePressed" event handler script, call

myEditBox:ClearFocus; Peeka 05:06, 9 March 2008 (UTC)

tinsert(UISpecialFrames,myframe1:GetName); tinsert(UISpecialFrames,myframe2:GetName);
 * tinsert(UISpecialFrames,this:GetName); only works on frames that get focus.  Calling it once in the xml will not work if you have multiple frames in your addon.  You need to call it for every major frame in your code.  Eg.

Obviously, for the GetName to work, the frame must have a name, ie. if you created the frame in Lua with CreateFrame, you have to have a string for the second argument of CreateFrame. Peeka 05:06, 9 March 2008 (UTC)