Thread Tools Display Modes
03-21-15, 09:23 AM   #1
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
ToggleTalentFrame() / ToggleGlyphFrame() taint issue

Hello, I'm trying to create a custom game menu and I'm having trouble with two buttons pertaining to the talent and glyph frames.

The taint issue comes from calling ToggleTalentFrame() and ToggleGlyphFrame() insecurely. Since these frames are not loaded by default, I can't use ToggleFrame() as I do with the Spellbook. My question is whether it's possible to actually open these frames with code without it blowing up in my face.

Edit: Here's the updated code:
Lua Code:
  1. local function ToggleTalentUI()
  2.     if not PlayerTalentFrame then
  3.         LoadAddOn("Blizzard_TalentUI");
  4.     end
  5.     ShowUIPanel(PlayerTalentFrame);
  6. end
  7.  
  8. local customButtons = {
  9.     {name = "Character",    title = "Character Info",   ClickFunc = ToggleCharacter,    arg = "PaperDollFrame"},
  10.     {name = "Spellbook",    title = "Spellbook",        ClickFunc = ToggleFrame,        arg = SpellBookFrame},
  11.     {name = "Talent",       title = "Specialization",   ClickFunc = ToggleTalentUI,     arg = nil},
  12.     {name = "Bag",          title = "Bags",             ClickFunc = ToggleAllBags,      arg = nil},
  13.     {name = "Achievement",  title = "Achievements",     ClickFunc = ToggleAchievementFrame, arg = nil},
  14.     {name = "QuestLog",     title = "Quest Log",        ClickFunc = ToggleQuestLog,     arg = nil},
  15.     {name = "LFD",          title = "Group Finder",     ClickFunc = PVEFrame_ToggleFrame, arg = nil},
  16.     {name = "PvP",          title = "PvP",              ClickFunc = TogglePVPUI,        arg = nil},
  17.     {name = "Collections",  title = "Collections",      ClickFunc = ToggleCollectionsJournal, arg = nil},
  18.     {name = "EJ",           title = "Dungeon Journal",  ClickFunc = ToggleEncounterJournal, arg = nil},
  19.     {name = "Garrison",     title = "Garrison Report",  ClickFunc = ToggleGarrisonReport, arg = nil},
  20.     {name = "Score",        title = "Score Screen",     ClickFunc = ToggleWorldStateScoreFrame, arg = nil},
  21.     {name = "Social",       title = "Social",           ClickFunc = ToggleFriendsFrame, arg = nil},
  22.     {name = "Guild",        title = "Guild",            ClickFunc = ToggleGuildFrame,   arg = nil},
  23. }
  24.  
  25. for i, btn in pairs(customButtons) do
  26.     local button = CreateFrame("BUTTON", "GameMenuButton"..btn.name, GameMenuFrame, "GameMenuButtonTemplate");
  27.     local anchor = customButtons[i-1] and customButtons[i-1].name or nil;
  28.     button:SetText(btn.title);
  29.     if anchor then
  30.         button:SetPoint("TOP", _G["GameMenuButton"..anchor], "BOTTOM", 0, -1);
  31.     else
  32.         button:SetPoint("TOPRIGHT", GameMenuFrame, "TOPRIGHT", -20, -20);
  33.     end
  34.     button:SetScript("OnClick", function(...)
  35.         ToggleFrame(GameMenuFrame);
  36.         btn.ClickFunc(btn.arg);
  37.     end);
  38.     table.insert(buttons, button);
  39. end
Here's what it ends up looking like atm.
__________________

Last edited by MunkDev : 03-21-15 at 02:04 PM.
  Reply With Quote
03-21-15, 10:16 AM   #2
10leej
A Molten Giant
 
10leej's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2011
Posts: 583
I use this in Click Menu for the talents, I don't call glyphs though.

Code:
if (not PlayerTalentFrame) then
LoadAddOn('Blizzard_TalentUI')
end

if (not GlyphFrame) then
  LoadAddOn('Blizzard_GlyphUI')
end

securecall(ToggleTalentFrame)
__________________
Tweets YouTube Website
  Reply With Quote
03-21-15, 10:21 AM   #3
Clamsoda
A Frostmaul Preserver
Join Date: Nov 2011
Posts: 269
I know a decent way to avoid taint is to run the click method on any buttons that exist. You could run the click method on the micro menus' TalentMicroButton. You could then run the click method on the "Glyphs" tab.

Lua Code:
  1. TalentMicroButton:Click()

Lua Code:
  1. if (PlayerTalentFrame:IsShown()) then
  2.     PlayerTalentFrameTab3:Click()
  3. end

I know that doesn't help with load on demand issues, but it is a start.
  Reply With Quote
03-21-15, 10:25 AM   #4
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Lua Code:
  1. ShowUIPanel(PlayerTalentFrame) -- Always opens on the last used tab
  2. HideUIPanel(PlayerTalentFrame)
  3.  
  4. PlayerTalentFrame_Toggle(GetActiveSpecGroup()) -- 1 for primary 2 for secondary
  5.  
  6. PlayerTalentFrame_ToggleGlyphFrame(GetActiveSpecGroup()) -- 1 for primary 2 for secondary

Last edited by Resike : 03-21-15 at 10:30 AM.
  Reply With Quote
03-21-15, 10:30 AM   #5
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Resike: Your approach works for opening the talent frame, but using
Lua Code:
  1. PlayerTalentFrame_ToggleGlyphFrame(GetActiveSpecGroup())
seems to still cause the taint in the glyph frame.

The other solutions you guys provided cause full on taint, just like my original approach.

Edit: Maybe I should add I'm not clicking these with my mouse.
__________________

Last edited by MunkDev : 03-21-15 at 10:54 AM.
  Reply With Quote
03-21-15, 11:02 AM   #6
MunkDev
A Scalebane Royal Guard
 
MunkDev's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2015
Posts: 431
Bah, I've decided against a dedicated Glyph button. It's not that necessary.
Thanks for the help everyone.
__________________
  Reply With Quote
03-21-15, 11:04 AM   #7
Resike
A Pyroguard Emberseer
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,290
Originally Posted by MunkDev View Post
Bah, I've decided against a dedicated Glyph button. It's not that necessary.
Thanks for the help everyone.
Nononon, here you go:
Lua Code:
  1. function ToggleTalentTab(tabNumber)
  2.     if not PlayerTalentFrame or not PlayerTalentFrame:IsShown() then
  3.         GlyphFrame_LoadUI()
  4.         ShowUIPanel(PlayerTalentFrame)
  5.         PanelTemplates_SetTab(PlayerTalentFrame, tabNumber)
  6.         PlayerTalentFrame_HideTalentTab()
  7.         PlayerTalentFrame_HideSpecsTab()
  8.         PlayerTalentFrame_ShowGlyphFrame()
  9.         PlayerTalentFrame_HidePetSpecTab()
  10.     else
  11.         HideUIPanel(PlayerTalentFrame)
  12.     end
  13. end
  14.  
  15. -- To toggle tabs [1-4]
  16. ToggleTalentTab(3)

Edit: Made some changes should work for every tab now and it's toggleable.

Last edited by Resike : 03-21-15 at 11:12 AM.
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » ToggleTalentFrame() / ToggleGlyphFrame() taint issue


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