View Single Post
09-19-11, 11:48 PM   #11
SDPhantom
A Pyroguard Emberseer
 
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 2,326
Originally Posted by Torhal View Post
Originally Posted by Haleth View Post
Code:
table.insert(UISpecialFrames, yourframehere)
The Blizzard script that closes frames in the UISpecialFrames table uses a SecureCall, and thus shouldn't cause any taint even when the frame is tainted.
It won't. I make several frames closable via this method, as do many other AddOn authors. In fact, it's the only real way to do this without taint.
Making a frame able to receive key events through frame:EnableKeyboard() then writing a script for the OnKeyUp or OnKeyDown handler to check the key argument passed for the Esc key also works. I've seen some Blizzard frames use this method too.

Code:
frame:EnableKeyboard(1);
frame:SetScript("OnKeyDown",function(self,key)
--	This can be checked for the ESC key, but we'll check for what the keybind uses
	if GetBindingFromClick(key)=="TOGGLEGAMEMENU" then
		self:Hide();
	end
end);
__________________
WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote