Confirming note Edit
- Note - Hooking FriendsFrame's OnEvent handler is a really bad idea, because FriendsFrame contains the raid tab. This would likely cause you a lot of problems with the new secure framework. Using FriendsFrame:Hide() is also probably not a good idea unless you're absolutely sure when your code is going to be run. Otherwise, you may inadvertantly hide the FriendsFrame when the player is using it.
I agree with the above. I hooked the WhoList_Update function instead. This is the function called by the event handler as well as other parts of the code that brings up the FriendsFrame in Who mode. My code is below
OrigWhoList_Update = WhoList_Update; function WhoList_Update() if (not SWALLOW_NEXT_WHO) then OrigWhoList_Update(); end end
Okay, in further research of the FrameXML I actually did something different. Not sure if this is better or worse? I basically hooked the OnShow and OnHide methods of the friends frame to register the event on showing the frame and unregistering the event on hiding the frame. I'm currently testing.
Note might need some updating to be currentEdit
As it stands, using FriendsFrame:Hide() carries more issues with it than the chance of simply closing the frame on the user, as it doesn't completely close the frame in the first place. Hiding it will make the frame invisible, will prevent interaction with it, and will even play the close sound - but it is still technically there. Any additional windows will show up to the right of it, as if it were still open, and the game menu will not pop up if you hit the Escape key. See, because that frame is still technically there; but you can't interact with it - hitting escape will not close the frame, and since it's still open, the game menu will not show up.
A much better solution would be to use ToggleFriendsFrame(). This will actually close (or open) the frame, allowing you to auto-close it - provided you make sure that your code is the reason it's open, and that it's actually open (Otherwise, the same potential problem exists for the Note on FriendsFrame:Hide(), with the added chance that you may actually open the frame if it's already closed. Digital Utopia (talk) 13:25, June 16, 2012 (UTC)