Originally Posted by semlar
If you're not planning on doing something restricted based on the visibility of the map, and I'm not sure why you would, you can just call :EnableKeyboard(true) on the WorldMapFrame and give it something to do OnKeyDown.
|
Unless we're talking EditBox, I don't think you can keep moving around with keyboard enabled on a frame?
I've investigated the problem a bit, created a mock frame and tried to wrap its OnHide script with my current handler. This seems to work just fine, aslong as the frame in question is secure. In order to hide the frame in combat, I had to create a secure button for that aswell. The problem I face next is how (if its even possible) I can hide the frame by pressing Escape (ToggleGameMenu()), since it doesn't work simply by inserting the frame into the UISpecialFrames table.
This is the code I'm playing around with:
Lua Code:
local Frame = CreateFrame("FRAME", "MockFrame", UIParent, "SecureHandlerBaseTemplate")
Frame.Exit = CreateFrame("BUTTON", nil, Frame, "SecureActionButtonTemplate")
-- this works in and out of combat to hide the frame
Frame:WrapScript(Frame.Exit, "OnClick", [[
self:GetParent():Hide();
]])
-- this doesn't work in combat
-- tinsert(UISpecialFrames, "MockFrame");
-- Handler
m:WrapScript(MockFrame, "OnHide", [[
-- run secure shit here
]])