WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   AddOn Help/Support (https://www.wowinterface.com/forums/forumdisplay.php?f=3)
-   -   Works in /run, NOT in addon (https://www.wowinterface.com/forums/showthread.php?t=59758)

jlrm365 01-11-24 08:03 PM

Works in /run, NOT in addon
 
Ok. Baby steps.

Framestack showed two things I'd like to hide:
  1. The tiny button to the top-right of the minimap, appearing as a number - titled "AddOns" when you hover over it
  2. The big button on the bottom-left of the minimap that shows your dragon riding points and dragonflight reps

I used this:

Code:

local f = CreateFrame("Frame")
f:SetScript("OnEvent",function(self,event,...)
  AddonCompartmentFrame:Hide()
  ExpansionLandingPageMinimapButton:Hide()
end)
f:RegisterEvent("PLAYER_LOGIN")

#2 (The big button on the minimap) disappears, as I'd like it to.
#1 (The tiny numbered button) does not.

What confuses me is that #1's line works just fine as part of this "run" command:
/run AddonCompartmentFrame:Hide()

What needs to change, to make it work within the addon (so that both of those "Hide()" lines work)?

Thanks!
:cool:

Fizzlemizz 01-11-24 10:09 PM

The AddonCompartmentFrame's UpdateDisplay method has an explicit self:Show()

The initial UpdateDisplay happens in the PLAYER_ENTERING_WORLD event which runs after PLAYER_LOGIN.

It will do and additonal UpdateDisplay for each registerd addon including those that are Load-On-Demand (LOD) which can be loaded at any time during a session.

Try replacing AddonCompartmentFrame:Hide() with
Lua Code:
  1. AddonCompartmentFrame:HookScript("OnShow", function(self)
  2.     self:Hide()
  3. end)

jlrm365 01-12-24 12:24 AM

Quote:

Originally Posted by Fizzlemizz (Post 343157)
The AddonCompartmentFrame's UpdateDisplay method has an explicit self:Show()

The initial UpdateDisplay happens in the PLAYER_ENTERING_WORLD event which runs after PLAYER_LOGIN.

It will do and additonal UpdateDisplay for each registerd addon including those that are Load-On-Demand (LOD) which can be loaded at any time during a session.

Try replacing AddonCompartmentFrame:Hide() with
Lua Code:
  1. AddonCompartmentFrame:HookScript("OnSHow", function(self)
  2.     self:Hide()
  3. end)


Unless I misunderstood, this is what I ended up with:

Code:

local f = CreateFrame("Frame")
f:SetScript("OnEvent",function(self,event,...)
  AddonCompartmentFrame:HookScript("OnSHow", function(self)
      self:Hide()
  end)
  ExpansionLandingPageMinimapButton:Hide()
end)
f:RegisterEvent("PLAYER_LOGIN")

I still see the Numbered button / "AddOns" menu button.
Thanks for checking in, though.

Xrystal 01-12-24 06:32 AM

Try changing it to OnShow - think there was a minor hiccough in the typing there.

Fizzlemizz 01-12-24 08:51 AM

Xrystal is indeed correct. Lua is case sensitive but my brain sometimes refuses to accept it. Apologies.

Fixed the code in my original post for future travelers.

jlrm365 01-12-24 01:12 PM

Quote:

Originally Posted by Fizzlemizz (Post 343160)
Xrystal is indeed correct. Lua is case sensitive but my brain sometimes refuses to accept it. Apologies.

Fixed the code in my original post for future travelers.

Much appreciated.

Code:

There still appears to be something missing, however.

local f = CreateFrame("Frame")
f:SetScript("OnEvent",function(self,event,...)
  AddonCompartmentFrame:HookScript("OnShow", function(self)
      self:Hide()
  end)
  ExpansionLandingPageMinimapButton:Hide()
end)
f:RegisterEvent("PLAYER_LOGIN")

That's what I have now. NB small "h".

Loading up all of my addons, I still saw the little numbered button I want to hide. Something wasn't working.

Steps taken:
  • All addons removed, except the addons in that list (indicated by the button), in case something else was conflicting.
  • Loading just those up, the button still showed.
  • Removed all but one of that smaller list of addons (so then just loading this addon (in this thread) and one other). The button still showed.
  • Tried again, with another random addon (just this one and the random addon), and the button still showed.

I can only assume something's missing, in the code above, but I am not yet educated enough to spot it.

Fizzlemizz 01-12-24 02:01 PM

The Blizzard UI with the exception of LOD addons is loaded before 3rd party addons which means yoiu don't need to create a frame and wait for an event to do what you are wanting.

That asside, I was obviously having a bad day yesterday, OnShow won't fire until after a frame has been hidden in order to actually Show.

This would be your entire addon:
Lua Code:
  1. AddonCompartmentFrame:SetScript("OnShow", function(self)
  2.     self:Hide()
  3. end)
  4. AddonCompartmentFrame:Hide()
  5. ExpansionLandingPageMinimapButton:SetScript("OnShow", function(self)
  6.     self:Hide()
  7. end)
  8. ExpansionLandingPageMinimapButton:Hide()

Added the OnShow/Hide for ExpansionLandingPageMinimapButton (for characters leveling into an expansion where it becomes available)

jlrm365 01-12-24 02:34 PM

Quote:

Originally Posted by Fizzlemizz (Post 343163)
The Blizzard UI with the exception of LOD addons is loaded before 3rd party addons which means yoiu don't need to create a frame and wait for an event to do what you are wanting.

That asside, I was obviously having a bad day yesterday, OnShow won't fire until after a frame has been hidden in order to actually Show.

This would be your entire addon:
Lua Code:
  1. AddonCompartmentFrame:SetScript("OnShow", function(self)
  2.     self:Hide()
  3. end)
  4. AddonCompartmentFrame:Hide()
  5. ExpansionLandingPageMinimapButton:SetScript("OnShow", function(self)
  6.     self:Hide()
  7. end)
  8. ExpansionLandingPageMinimapButton:Hide()

Added the OnShow/Hide for ExpansionLandingPageMinimapButton (for characters leveling into an expansion where it becomes available)

Very kind and much appreciated. I'm on my way out, but will edit this response when I've had time to fire the game up again.

EDIT: It works, just as I had hoped. The big dragon isles summary button (bottom left) and the small addons button (top right) are gone. Combining this with HidingBar, the minimap area looks CLEAN!

Thanks for the time!


All times are GMT -6. The time now is 03:08 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI