Thread Tools Display Modes
09-18-11, 03:17 PM   #1
wellbeing
A Cliff Giant
Join Date: Oct 2009
Posts: 71
Hiding frames with esc

I believe this to be the root of a mysterious problem with my addon that causes the esc key to lose it's blizzard functionality(ie: clear target, game menu) but I didn't ask this question implicitly in the OP:


I'm not able to get the following code to work:
Code:

Code:
gaFrame:SetScript("OnEscapePressed", function(self) self:Hide() end)
error: gaFrame doesn't have a "OnEscapePressed" script

do I need to do something obvious to get this to work right?

Last edited by wellbeing : 09-18-11 at 03:25 PM. Reason: accuracy
  Reply With Quote
09-18-11, 03:24 PM   #2
Dridzt
A Pyroguard Emberseer
 
Dridzt's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2005
Posts: 1,360
The proper way to have frames hide with Esc is to add your frame to the UISpecialFrames table.
  Reply With Quote
09-18-11, 03:46 PM   #3
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
I agree, I believe it would also fix taint issues (not confirmed, have not tested myself but assuming it would since Blizzard made that API for a reason).
  Reply With Quote
09-18-11, 03:52 PM   #4
wellbeing
A Cliff Giant
Join Date: Oct 2009
Posts: 71
So after the reply from D, I determined that it's not the frame that is causing the esc key problems.

I'm lost. It's in my code somewhere.
  Reply With Quote
09-18-11, 04:03 PM   #5
wellbeing
A Cliff Giant
Join Date: Oct 2009
Posts: 71
AHHH, I found WHERE. Now if i can just find out WHY.

it seems that implementing



MacroFrame:Hide()

directly after:

ShowMacroFrame()

causes this esc key problem.

Maybe i don't understand ShowMacroFrame() in that it doesn't actually show the frame until you :Show() it. Whatever the reason, don't do them back to back, don't get the problem.

gg.
  Reply With Quote
09-19-11, 06:34 AM   #6
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Try registering ADDON_LOADED, wait for 'Blizzard_MacroUI' on the first arg, then hide the macro frame.

ShowMacroFrame() just loads the interface and shows it once loaded.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Hiding frames with esc


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off