View Single Post
09-12-19, 05:53 PM   #1
kernighan
A Cyclonian
AddOn Author - Click to view addons
Join Date: Mar 2008
Posts: 45
Using ToggleGuildFrame() inside an addon

I have a guild related addon, and for some reason, ToggleGuildFrame() doesn't do anything when executed inside of it, but if I execute ToggleGuildFrame() via a macro, it opens up the social tab (albeit on Groups tab rather than the guild tab, not sure how to tell it which subtab to pick).

In any case, I've got print statements in the code, and can confirm it gets to the code to execute ToggleGuildFrame, but nothing happens. Any idea on how I can get this to work?

Code:
function TitanPanelGuildButton_OnClick(self, button)
	-- open the guild pane on a left click
	print("Got a click");
	if ( button == "LeftButton" and not IsControlKeyDown()) then
	    print("button is left button");
		if (not FriendsFrame:IsVisible()) then
		    print("Toggling guild frame");
		    ToggleGuildFrame();
                    print("Friends Frame update");
		    --ToggleFriendsFrame(TITAN_GUILD_TAB_NUMBER);
		    FriendsFrame_Update();
		elseif (FriendsFrame:IsVisible()) then
			ToggleGuildFrame();
			--ToggleFriendsFrame(TITAN_GUILD_TAB_NUMBER);
		end
	elseif ( button == "LeftButton" and IsControlKeyDown()) then
		-- forcing an update, since auto-update might be off
		FriendsFrame:UnregisterEvent("GUILD_ROSTER_UPDATE");
		if (IsInGuild()) then
			GuildRoster();
		end
		FriendsFrame:RegisterEvent("GUILD_ROSTER_UPDATE");
		TitanPanelGuildButton_ListInitMaster();
	end
	
	GUILD_THIS = self;
end
Thanks!
  Reply With Quote