Quantcast Trying to hide a stubborn frame - WoWInterface
Thread Tools Display Modes
08-23-12, 12:25 PM   #1
A Defias Bandit
Join Date: Aug 2012
Posts: 1
Trying to hide a stubborn frame

I am trying to remove the Achievement Statistics tab...it's an OCD nightmare that I want to pretend doesn't exist...

Here is what I have in my lua script:

It will not go away. If I run the same macro in game it works fine:

/script AchievementFrameTab3:Hide()
To test the lua script I have also tried:

The Griffons are successfully removed, but not the statistics tab

Hiding frames is super simple and I have never had this problem before, but this time I am stuck.

Anyone have any ideas?
  Reply With Quote
08-23-12, 12:33 PM   #2
An Aku'mai Servant
endx7's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2005
Posts: 38
Are you sure Blizzard_AchievementUI has been loaded when your code runs? I don't think the tab exists before then.
  Reply With Quote
08-23-12, 12:43 PM   #3
A Flamescale Wyrmkin
Miiru's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2008
Posts: 138
local frame =CreateFrame("FRAME");																					
function frame:OnEvent(event, arg1)
if event == "ADDON_LOADED" and arg1 == "Blizzard_AchievementUI" then	


frame:SetScript("OnEvent", frame.OnEvent)
try this
◘◘ Author of MiirGui Texture Pack - [Core] [Blue] [Grey] ◘◘
  Reply With Quote
08-23-12, 01:07 PM   #4
A Pyroguard Emberseer
SDPhantom's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2006
Posts: 1,889
It seems to be working fine here. Are you running the code after the Blizzard_AchievementUI LoD addon has loaded? You can either wait for it to load naturally and run a hook then for force it to load before attempting to modify it.

Here are a couple examples:
Lua Code:
  1. if LoadAddOn("Blizzard_AchievementUI") then--   Make sure it does load or the next line will throw an error
  2.     AchievementFrameTab3:Hide();
  3. end

Lua Code:
  1. if IsAddOnLoaded("Blizzard_AchievementUI") then--   If it's already loaded, we don't need to waste memory creating a load hook
  2.     AchievementFrameTab3:Hide();
  3. else
  4.     local eframe=CreateFrame("Frame");
  5.     eframe:RegisterEvent("ADDON_LOADED");
  6.     eframe:SetScript("OnEvent",function(self,event,...)
  7.         if event=="ADDON_LOADED" and (...)=="Blizzard_AchievementUI" then
  8.             AchievementFrameTab3:Hide();
  9.             self:UnregisterEvent(event);--  Don't need this event firing anymore, saving CPU time
  10.             self:SetScript("OnEvent",nil);--    Optional too, but letting GarbageCollect pick up this function
  11.         end
  12.     end);
  13. end

PS: They type their code faster than me.
ESOUI AddOns | WoWInterface AddOns
"All I want is a pretty girl, a decent meal, and the right to shoot lightning at fools."
-Anders (Dragon Age: Origins - Awakening)
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Trying to hide a stubborn frame

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