Thread Tools Display Modes
03-18-20, 11:04 AM   #1
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Is possible to open Guild (or communities) Frame to a specific TAB ?

Hi everyone.

I am writing a small addon and I'd like to show the guild frame directly in the "Roster" tab.

The problem is that if I call:

Lua Code:
  1. ToggleGuildFrame()
  2.  
  3. or
  4.  
  5. ToggleCommunitiesFrame()

It opens in the "Chat" tab which I think is the default.
I tried to read the wow interface source and I think it is not possible to pass a param to choose one tab I want to open like:

Lua Code:
  1. ToggleFriendsFrame(3)

for example.

But I am a neewbie and so I ask for a confirmation here
Any idea ? Tips ? Tricks ?

Thanks
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
03-18-20, 11:39 AM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Looking through Blizzard's code, try this
Lua Code:
  1. GuildFrame_TabClicked(GuildFrameTab2)
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote
03-18-20, 11:41 AM   #3
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Code:
ToggleGuildFrame() 
CommunitiesFrame.GuildInfoTab:GetScript("OnClick")(CommunitiesFrame.GuildInfoTab)
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-18-20, 11:46 AM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
I took the lazy option
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
03-18-20, 10:24 PM   #5
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Hi,

thanks so much for help, but both solutions dont work :/ .

May I miss something ?

Thanks .
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
03-18-20, 10:32 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
As an addon (retail) running /gdo using the code below opens the guild window to the guild information tab.

If the frame isn't shown, it will open it and if it is shown but on another tab it will open the info tab.

Lua Code:
  1. SLASH_GLDOPEN1 = "/gdo"
  2. SlashCmdList["GLDOPEN"] = function()
  3.     if not CommunitiesFrame or not CommunitiesFrame:IsShown() then
  4.         ToggleGuildFrame()
  5.     end
  6.     CommunitiesFrame.GuildInfoTab:GetScript("OnClick")(CommunitiesFrame.GuildInfoTab)
  7. end

Even if you're not in a guild so it would probably be best to use a "in guild" check.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-18-20 at 10:44 PM.
  Reply With Quote
03-19-20, 09:00 AM   #7
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Thanks so much for your reply Fizzlemizz.

The tab name was the wrong one but finally you give me the advice to find how to find the right name.

Google gives me 2 results, one was this:



The problem is that the tab is selected correctly but it is not activated.



Any idea ?
Thanks
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
03-19-20, 09:13 AM   #8
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
You need to change both instances of the tab frame name in the call.

Code:
CommunitiesFrame.RosterTab:GetScript("OnClick")(CommunitiesFrame.RosterTab)
Otherwise you're calling the roster tab but passing in the info tab which then becomes "self" for the OnClick script.

Seerah's method would be better but I don't have time to rumage through the code.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-19-20 at 09:18 AM.
  Reply With Quote
03-19-20, 12:09 PM   #9
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Omg

I saw the finger but not the moon
It does work now as expected

The Seerah's solution had to work, I have found on internet a lot of evidences of it after she proposed but it doesn't for me :/

For example:




Sorry again for my mistake and thanks again.
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote
03-19-20, 12:31 PM   #10
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Doing it the proper (Seerah) way it would be:

Code:
if not CommunitiesFrame or not CommunitiesFrame:IsShown() then 
	ToggleGuildFrame() 
end 
CommunitiesFrame:SetDisplayMode(COMMUNITIES_FRAME_DISPLAY_MODES.ROSTER)
Although they both end up doing the same thing, my way adds 2 additional function calls (GetScript and the OnClick call).

XML for the roster tab:
Code:
<CheckButton name="CommunitiesRosterTabTemplate" hidden="true" inherits="CommunitiesFrameTabTemplate" virtual="true">
	<KeyValues>
		<KeyValue key="tooltip" value="COMMUNITIES_ROSTER_TAB_TOOLTIP" type="global"/>
	</KeyValues>
	<Scripts>
		<OnLoad>
			self.Icon:SetTexture("Interface\\Icons\\achievement_guildperk_everybodysfriend");
		</OnLoad>
		<OnClick inherit="append">
			self:GetParent():SetDisplayMode(COMMUNITIES_FRAME_DISPLAY_MODES.ROSTER);
		</OnClick>
	</Scripts>
</CheckButton>
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 03-19-20 at 12:52 PM.
  Reply With Quote
03-19-20, 12:58 PM   #11
gmarco
An Onyxian Warder
 
gmarco's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 362
Yes !

Now it works like a charm

Thanks so much
__________________
This is Unix-Land. In quiet nights, you can hear the Windows machines reboot.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Is possible to open Guild (or communities) Frame to a specific TAB ?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off