• 0

    posted a message on AcceptGroup() and StaticPopup_Hide()
    Quote from jerry
    I really fail to see what problem you have with unregistering a event on a frame. And I beg to differ on the idea that it's more likely to fail than the idea I have seen around here, which either rely on undocumented assertions (that frame receive an event in a particular order that is not random) or that present the user with a confusing interface that make him think that he has a choice where he doesn't.

    If you want to notify the user that he has entered a group, then you can do that.


    No need to defend your solution, it's perfectly valid and I wasn't intending my comment as an attack. I just prefer checking on the PARTY_MEMBERS_CHANGED event, that's it.
    Posted in: Lua Code Discussion
  • 0

    posted a message on AcceptGroup() and StaticPopup_Hide()
    I'm not comfortable with jerry's solution for that reason. It seems more likely to break down the line, should Blizzard decide to add something else to that event later.

    Here's the solution I'm using:

    function Automaton_Group:ProcessInvite(accept)
    	if accept then
    		AcceptGroup()
    		self:RegisterEvent("PARTY_MEMBERS_CHANGED")
    	else
    		DeclineGroup()
    	end
    end
    
    function Automaton_Group:PARTY_MEMBERS_CHANGED()
    	StaticPopup_Hide("PARTY_INVITE")
    	self:UnregisterEvent("PARTY_MEMBERS_CHANGED")	
    end


    The only downside with this method might be that the window does actually get displayed for a second or two, depending how long it takes for your AcceptGroup() to go through. Personally, I prefer it this way, since it calls a little more attention to itself. I used to frequently not even notice I had joined a group.
    Posted in: Lua Code Discussion
  • 0

    posted a message on AcceptGroup() and StaticPopup_Hide()
    I registered the PARTY_MEMBERS_CHANGED event and close the static popup in Automaton that way. Works dandy.
    Posted in: Lua Code Discussion
  • To post a comment, please or register a new account.