Thread Tools Display Modes
06-23-19, 09:33 AM   #1
Lybrial
A Flamescale Wyrmkin
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 120
How to get hidden frames?

I want to manipulate a hidden frame from BigWigs - the BigWigsAnchor.
Here is the code on their github:

BigWigs/Bars.lua

As you can see there at the end they do display:Hide(). I guess this is the
reason why I cannot get the frame:

Code:
local count = GetNumAddOns();
	
for i = 1, count do
	local name = GetAddOnInfo(i);
	
	if (IsAddOnLoaded(i) and (name == "BigWigs")) then
		-- BigWigs is loaded
                local frame = _G["BigWigsAnchor"];

                if (frame) then
                    -- do stuff
                else
                    print("BigWigsAnchor does not exist");
                end
	end
end

Is there a way to also get and manipulate hidden frames? Or could there be another reason why BigWigsAnchor is always nil?

Last edited by Lybrial : 06-23-19 at 09:35 AM.
  Reply With Quote
06-23-19, 09:58 AM   #2
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
I don't know BigWigs but that code tells me it is marked as Load On Demand (LOD).

If you open it's .TOC file you should see and entry:
Code:
## LoadOnDemand: 1
This means the addon (and it's frames) are not loaded/created until the addon is specifically loaded during play (probably by entering a dungeon or raid).

You have two choices,

1. Wait for an "ADDON_LOADED" event where the first payload parameter (the addons name for this event) is "BigWigs" and then do what you need to do,

2. Test if the addon is loaded and if not, load it yourself using
Code:
if not IsAddOnLoaded("BigWigs")
      local Loaded, Reason = LoadAddOn("BigWigs")
      if Loaded then
           -- do what you need to do
      else
            -- it didn't load for Reason
      end
end
I would suggest using the first if possible unless there is some specific reason you need the BigWigs frames earlier.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.

Last edited by Fizzlemizz : 06-23-19 at 10:36 AM.
  Reply With Quote
06-23-19, 10:48 AM   #3
Lybrial
A Flamescale Wyrmkin
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 120
Thx, did not know about load on demand.
Have to think of something to work with that. Thanks.
  Reply With Quote
06-23-19, 11:14 AM   #4
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Lua Code:
  1. local f = CreateFrame("Frame", "LybrialEventFrame")
  2. f:SetScript("OnEvent", function(self, event, ...)
  3.     local arg1 = ... --(arg1 will be the name of the addon just loaded for the "ADDON_LOADED" event)
  4.     if event == "ADDON_LOADED" and arg1 == "BigWigs" then
  5.         -- Initial Bigwigs frames should be created now
  6.     end
  7. end)
  8. f:RegisterEvent("ADDON_LOADED")
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
06-23-19, 02:25 PM   #5
Lybrial
A Flamescale Wyrmkin
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 120
Yeah. The Problem ist Not the Code. I Neef to think about If it makes sense to load the addons I need or if I can find a better solution.

Here a small Video of what im working on:

https://m.youtube.com/watch?v=9N0dxKoV8Qg

It will be possible to move all the anchors. Currently it is already working for Grid2, Hekili, Raven and my own unit frames. The LOD makes it Harder.
  Reply With Quote
06-23-19, 02:36 PM   #6
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
The code was to show how your addon might not do anything about adding frames for BigWigs until BigWigs loads and then at that time add whatever you need.

You could also create a second addon (addon folder with it's own .TOC) and mark it to Load With BigWigs.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
06-24-19, 12:02 AM   #7
Lybrial
A Flamescale Wyrmkin
AddOn Compiler - Click to view compilations
Join Date: Jan 2010
Posts: 120
Yes, but this would not work for my configuration mode. In my AddOn
you can press a button "Toggle Anchors" which will create and toggle
frame overlays which show all the positions and names of all anchors,
makes them moveable and resizable. You would not be able to configure
BigWigs position and size outside of dungeons, where BigWigs is loaded.

So for the configuration mode I would anyway need to load BigWigs if
it is not yet loaded.
  Reply With Quote
06-24-19, 01:12 AM   #8
Fizzlemizz
I did that?
 
Fizzlemizz's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Dec 2011
Posts: 1,871
Originally Posted by Lybrial View Post
So for the configuration mode I would anyway need to load BigWigs if
it is not yet loaded.
That's OK also.
__________________
Fizzlemizz
Maintainer of Discord Unit Frames and Discord Art.
Author of FauxMazzle, FauxMazzleHUD and Move Pad Plus.
  Reply With Quote
06-25-19, 06:44 PM   #9
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Doesn't BigWigs have a config mode?
__________________
"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

WoWInterface » Developer Discussions » Lua/XML Help » How to get hidden frames?

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