WoW:API SetWhoToUI: Difference between revisions

no edit summary
m (Added note to unregister event from FriendsFrame)
No edit summary
Line 1: Line 1:
<center>'''SetWhoToUI''' - ''Documentation by [[User:Noccy|Noccy]]''</center>
{{wowapi}} __NOTOC__
 
Sets where the result of a [[API SendWho]] request will be handled.


  SetWhoToUI(state);
  SetWhoToUI(state);
:Sets where the result of a [[API SendWho]] request will be handled.


== Parameters ==
== Parameters ==
Line 14: Line 14:


=== Notes ===
=== Notes ===
:During my experiments with this function, the Who dialog still popped up. However, this can be avoided by using FriendsFrame:Hide(); or a combination of FriendsFrame:UnregisterEvent("WHO_LIST_UPDATE"); and FriendsFrame:RegisterEvent("WHO_LIST_UPDATE");
:During [[User:Noccy|my]] experiments with this function, the Who dialog still popped up. However, this can be avoided by using FriendsFrame:Hide(); or a combination of FriendsFrame:UnregisterEvent("WHO_LIST_UPDATE"); and FriendsFrame:RegisterEvent("WHO_LIST_UPDATE");
 
:Another way (perhaps slightly less complex, and easier to get to work with other addons) of avoiding the Who window popping up is to hook the <tt>FriendsFrame_OnEvent</tt> function and not letting the original handle <tt>WHO_LIST_UPDATE</tt> events when your own code is waiting for a reply.  ''Example:''
 
function my_FriendsFrame_OnEvent()
  if not(event == "WHO_LIST_UPDATE" and iAmWaitingForAReply) then
      original_FriendsFrame_OnEvent();
  end
end
original_FriendsFrame_OnEvent = FriendsFrame_OnEvent;
FriendsFrame_OnEvent = my_FriendsFrame_OnEvent;


__NOTOC__
:Of course your code should make sure to reset <tt>iAmWaitinForAReply</tt> periodically (e.g. in case you never get a reply!), and you should probably read [[HOWTO:_Hook_a_Function]] for more info on that subject.
{{Template:WoW API}}
Anonymous user