This site makes extensive use of JavaScript.
Please enable JavaScript in your browser.
Live
PTR
10.2.5
PTR
10.2.6
Unable to use "Escape" key after a SendWho
Post Reply
Return to board index
Post by
Taraezor
My add-on needs to get a list of logged in players at various levels. So I do, for example, a SendWho(90) to return up to 50 logged in players at level 90. Fine. Works well. Am able to iterate through all the players and spam them for gold selling.
Wait no! :D
Problem for my add-on is that I do NOT want the player to see the results on screen. I am aware that we can route to chat (I don't) or to display in the "Who" frame called in game the FriendsFrame.
So as soon as the event to show the frame triggers I do a FriendsFrame:Hide(). You hear the sound FX but see no frame. Acceptable I think.
Problem is that until I manually select the who frame by entering "O" on my keyboard, I am UNABLE to use the "escape" key. Once I display it manually, I can then hit "escape" and then any other "escape" at any other time will function as expected.
I am wondering how to solve this problem.
It is as though WoW doesn't like me quickly hiding the FriendsFrame and is swallowing the "Escape" key. I have also noticed that I can "fix" the problem by going to my guild vault, display the GV frame and then "Escape" functionality returns.
Post by
Neffi
The default interface defines a system for UI panels to be hidden and shown. This system is responsible for intelligently positioning the windows next to each other, even when multiple are opened.
You need to forsake using :Show() and :Hide() and instead use:
ShowUIPanel(frame)
HideUIPanel(frame)
The code of those functions is shown here. You can see the issue:
function ShowUIPanel(frame, force)
if ( not frame or frame:IsShown() ) then
return;
end
if ( not GetUIPanelWindowInfo(frame, "area") ) then
frame:Show();
return;
end
-- Dispatch to secure code
FramePositionDelegate:SetAttribute("panel-force", force);
FramePositionDelegate:SetAttribute("panel-frame", frame);
FramePositionDelegate:SetAttribute("panel-show", true);
end
function HideUIPanel(frame, skipSetPoint)
if ( not frame or not frame:IsShown() ) then
return;
end
if ( not GetUIPanelWindowInfo(frame, "area") ) then
frame:Hide();
return;
end
--Dispatch to secure code
FramePositionDelegate:SetAttribute("panel-frame", frame);
FramePositionDelegate:SetAttribute("panel-skipSetPoint", skipSetPoint);
FramePositionDelegate:SetAttribute("panel-hide", true);
end
Post by
Taraezor
Oh brilliant. Thank you very much. I could see I had radically gone wrong somewhere but just couldn't locate that "somewhere", lol.
It's not even in an essential part of the add-on. Silly me trying to load in a fun feature. You'll lol when you look at the code. (v2.0 released in a couple of days from now -
We Don't Wipe
).
Post by
Neffi
By the way, there are libraries out there that perform the /who logic for you. I recommend using them. Not only because it saves you a lot of time and hassle, but because some of them are very well implemented. They can, for instance: transparently queue SendWho without the user ever knowing; manage queues from multiple addons so you don't accidentally over-span the API and get the user server-kicked for flooding; and transparently handle re-transmission so your requests always get answered. You also get the benefit of a library that sees more large-scale use than your code and is more mature, thus is much more likely to be free of bugs.
Post by
pelf
I think it might actually even be called LibWho.
Post Reply
You are not logged in. Please
log in
to post a reply or
register
if you don't already have an account.