View Single Post
08-09-15, 11:49 AM   #3
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Originally Posted by semlar View Post
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:
  1. local Frame = CreateFrame("FRAME", "MockFrame", UIParent, "SecureHandlerBaseTemplate")
  2. Frame.Exit = CreateFrame("BUTTON", nil, Frame, "SecureActionButtonTemplate")
  3.  
  4. -- this works in and out of combat to hide the frame
  5. Frame:WrapScript(Frame.Exit, "OnClick", [[
  6.     self:GetParent():Hide();
  7. ]])
  8.  
  9. -- this doesn't work in combat
  10. -- tinsert(UISpecialFrames, "MockFrame");
  11.  
  12. -- Handler
  13. m:WrapScript(MockFrame, "OnHide", [[
  14.     -- run secure shit here
  15. ]])
__________________

Last edited by MunkDev : 08-09-15 at 05:22 PM.
  Reply With Quote