Thread Tools Display Modes
06-01-17, 05:47 AM   #1
Eommus
An Aku'mai Servant
Join Date: Apr 2017
Posts: 34
Hide "Main Action Bar" and "Bottom Left Bar"

Hi,

I am working on a simple addon which:

1. By default, will hide the main action bar (the action bar on the bottom left of the screen with 12 spell slots) and bottom left action bar (which is named as "Bottom Left Bar" in Interface > ActionBars options). It will not hide any other action bars.

2. It will show the two hidden bars when I click on an NPC, a player or self.

3. It will hide them when I deselect my target via ESC or via click on the ground or a non-target object.

For Step 1, I have the following so far:

Lua Code:
  1. local f = CreateFrame("Frame")
  2. f:RegisterEvent("ADDON_LOADED")
  3.  
  4. local function ActionBarsHide(self, event, arg1, ...)
  5.      if (event == "ADDON_LOADED" and arg1 == "MyAddonName") then
  6.         MainActionBar:Hide() -- not working
  7.         MultiBarBottomLeft:Hide() -- not working
  8.         -- print("test") -- working
  9.         f:UnregisterEvent("ADDON_LOADED")
  10.      end
  11. end
  12.  
  13. f:SetScript("OnEvent", ActionBarsHide)

Do you have an idea why MainActionBar:Hide() and MultiBarBottomLeft:Hide() are not working? And how I can make step 1 work?

Thanks.
  Reply With Quote
06-01-17, 08:58 AM   #2
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Here's a code of mine!

Lua Code:
  1. local ActionBars = CreateFrame("Frame")
  2.  
  3. local HiderPanel = CreateFrame("Frame", "AHiderPanel", UIParent)
  4. HiderPanel:Hide()
  5.  
  6. local _G = _G
  7. local MainMenuBar, MainMenuBarArtFrame = _G["MainMenuBar"], _G["MainMenuBarArtFrame"]
  8. local OverrideActionBar = _G["OverrideActionBar"]
  9. local PossessBarFrame = _G["PossessBarFrame"]
  10. local PetActionBarFrame = _G["PetActionBarFrame"]
  11. local ShapeshiftBarLeft, ShapeshiftBarMiddle, ShapeshiftBarRight = _G["ShapeshiftBarLeft"], _G["ShapeshiftBarMiddle"], _G["ShapeshiftBarRight"]
  12.  
  13. local Frames = {
  14.     MainMenuBar, MainMenuBarArtFrame, OverrideActionBar,
  15.     PossessBarFrame, PetActionBarFrame, IconIntroTracker,
  16.     ShapeshiftBarLeft, ShapeshiftBarMiddle, ShapeshiftBarRight,
  17.     TalentMicroButtonAlert, CollectionsMicroButtonAlert, EJMicroButtonAlert
  18. }
  19.  
  20. function ActionBars:DisableBlizzard()
  21.     for _, BlizzActionBarsArt in pairs(Frames) do
  22.         BlizzActionBarsArt:UnregisterAllEvents()
  23.         BlizzActionBarsArt.ignoreFramePositionManager = true
  24.         BlizzActionBarsArt:SetParent(AHiderPanel)
  25.     end
  26. end
  27.  
  28. ActionBars:RegisterEvent("PLAYER_LOGIN")
  29. ActionBars:RegisterEvent("PLAYER_ENTERING_WORLD")
  30. ActionBars:RegisterEvent("ADDON_LOADED")
  31.  
  32. ActionBars:SetScript("OnEvent", function(self, event, AddOn)
  33.     ActionBars:DisableBlizzard()
  34. end)
  Reply With Quote
06-01-17, 09:12 AM   #3
p3lim
A Pyroguard Emberseer
 
p3lim's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 1,710
Try this:

Lua Code:
  1. local Parent = CreateFrame('Frame', nil, UIParent, 'SecureHandlerStateTemplate')
  2. RegisterStateDriver(Parent, 'visibility', 'hide')
  3.  
  4. MainActionBar:SetParent(Parent)
  5. MultiBarBottomLeft:SetParent(Parent)
  Reply With Quote
06-02-17, 01:18 AM   #4
Eommus
An Aku'mai Servant
Join Date: Apr 2017
Posts: 34
Originally Posted by p3lim View Post
Try this:

Lua Code:
  1. local Parent = CreateFrame('Frame', nil, UIParent, 'SecureHandlerStateTemplate')
  2. RegisterStateDriver(Parent, 'visibility', 'hide')
  3.  
  4. MainActionBar:SetParent(Parent)
  5. MultiBarBottomLeft:SetParent(Parent)
Thanks, I tried your code (with all other addons disabled) but it did nothing.

Originally Posted by Game92 View Post
Here's a code of mine!

Lua Code:
  1. local ActionBars = CreateFrame("Frame")
  2.  
  3. local HiderPanel = CreateFrame("Frame", "AHiderPanel", UIParent)
  4. HiderPanel:Hide()
  5.  
  6. local _G = _G
  7. local MainMenuBar, MainMenuBarArtFrame = _G["MainMenuBar"], _G["MainMenuBarArtFrame"]
  8. local OverrideActionBar = _G["OverrideActionBar"]
  9. local PossessBarFrame = _G["PossessBarFrame"]
  10. local PetActionBarFrame = _G["PetActionBarFrame"]
  11. local ShapeshiftBarLeft, ShapeshiftBarMiddle, ShapeshiftBarRight = _G["ShapeshiftBarLeft"], _G["ShapeshiftBarMiddle"], _G["ShapeshiftBarRight"]
  12.  
  13. local Frames = {
  14.     MainMenuBar, MainMenuBarArtFrame, OverrideActionBar,
  15.     PossessBarFrame, PetActionBarFrame, IconIntroTracker,
  16.     ShapeshiftBarLeft, ShapeshiftBarMiddle, ShapeshiftBarRight,
  17.     TalentMicroButtonAlert, CollectionsMicroButtonAlert, EJMicroButtonAlert
  18. }
  19.  
  20. function ActionBars:DisableBlizzard()
  21.     for _, BlizzActionBarsArt in pairs(Frames) do
  22.         BlizzActionBarsArt:UnregisterAllEvents()
  23.         BlizzActionBarsArt.ignoreFramePositionManager = true
  24.         BlizzActionBarsArt:SetParent(AHiderPanel)
  25.     end
  26. end
  27.  
  28. ActionBars:RegisterEvent("PLAYER_LOGIN")
  29. ActionBars:RegisterEvent("PLAYER_ENTERING_WORLD")
  30. ActionBars:RegisterEvent("ADDON_LOADED")
  31.  
  32. ActionBars:SetScript("OnEvent", function(self, event, AddOn)
  33.     ActionBars:DisableBlizzard()
  34. end)
Thanks, your code hides also other actionbars such as Bottom Right Bar, Right Bar, Right Bar 2, as well as micro menu and some other parts of the action bar which I don't want to hide.

I only want to hide the 12-spells section of the main action bar, and the Bottom Left Bar, no other bars or interface elements.
  Reply With Quote
06-02-17, 05:56 AM   #5
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by Eommus View Post
Thanks, I tried your code (with all other addons disabled) but it did nothing.

You obviously don't have any error debugging addon like BugSack / Bugger loaded
This way you would have also known that MainActionBar does not exist and should be MainMenuBar

It would be useful if you actually showed more effort instead of saying "it did nothing"

I tried p3lim's snippet but it ended up hiding all of the action bars and the entire main menu though...
Lua Code:
  1. local Parent = CreateFrame('Frame', nil, UIParent, 'SecureHandlerStateTemplate')
  2. RegisterStateDriver(Parent, 'visibility', 'hide')
  3.  
  4. MainMenuBar:SetParent(Parent)
  5. MultiBarBottomLeft:SetParent(Parent)
  Reply With Quote
06-02-17, 06:00 AM   #6
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by Eommus View Post
Thanks, your code hides also other actionbars such as Bottom Right Bar, Right Bar, Right Bar 2, as well as micro menu and some other parts of the action bar which I don't want to hide.

Again, show some more effort. Just edit/remove the parts you don't need until you have what you want
  Reply With Quote
06-02-17, 06:51 AM   #7
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Code:
for id = 1, NUM_ACTIONBAR_BUTTONS do
	RegisterStateDriver(_G["ActionButton" .. id], "visibility", "[exists] show; hide")
end
RegisterStateDriver(MultiBarBottomLeft, "visibility", "[exists] show; hide")
  Reply With Quote
06-03-17, 01:10 AM   #8
Eommus
An Aku'mai Servant
Join Date: Apr 2017
Posts: 34
Originally Posted by Ketho View Post
It would be useful if you actually showed more effort instead of saying "it did nothing"
Originally Posted by Ketho View Post
Again, show some more effort.
Apparently, the effort I am showing as a beginner is not enough to ask questions on this site. If I knew of everything you or others suggested, I wouldn't be asking questions on the forums. Sorry for taking your time and thanks for all the help so far.
  Reply With Quote
06-03-17, 02:43 AM   #9
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
Originally Posted by Eommus View Post
Apparently, the effort I am showing as a beginner is not enough to ask questions on this site. If I knew of everything you or others suggested, I wouldn't be asking questions on the forums.

You made a good opening post but once people give solutions you fail to follow up on it and just say "it doesn't work". Anyway, did you try Vrul's example yet?

The most important part is how you solve the problem, I want to emphasize this again:
Originally Posted by MunkDev View Post
The important part is to know how to figure out how it works.
https://meta.stackexchange.com/quest...ampire-problem
  Reply With Quote
06-03-17, 05:10 AM   #10
Eommus
An Aku'mai Servant
Join Date: Apr 2017
Posts: 34
Originally Posted by Vrul View Post
Code:
for id = 1, NUM_ACTIONBAR_BUTTONS do
	RegisterStateDriver(_G["ActionButton" .. id], "visibility", "[exists] show; hide")
end
RegisterStateDriver(MultiBarBottomLeft, "visibility", "[exists] show; hide")
Thank you. Your code hides the main menu bar and bottom left bar, while keeping other bars visible, as I needed. Just a small issue though: When I open Game Menu > Interface > ActionBars and play with actionbar options by deselecting them, the hidden bottom left bar flashes for a fraction of a second. Any ideas why? The below video shows the issue:

https://www.youtube.com/watch?v=D3Fyp5sR1Ec
  Reply With Quote
06-03-17, 06:38 AM   #11
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
Originally Posted by Eommus View Post
Just a small issue though: When I open Game Menu > Interface > ActionBars and play with actionbar options by deselecting them, the hidden bottom left bar flashes for a fraction of a second. Any ideas why?
That is just the way the SecureStateDriver system works. Anything related to certain events will be resolved immediately and everything else is checked every 0.2 seconds. Target changes fall under the events portion while clicking options does not.
  Reply With Quote
06-06-17, 01:40 AM   #12
Eommus
An Aku'mai Servant
Join Date: Apr 2017
Posts: 34
Originally Posted by Vrul View Post
That is just the way the SecureStateDriver system works. Anything related to certain events will be resolved immediately and everything else is checked every 0.2 seconds. Target changes fall under the events portion while clicking options does not.
Thanks, I guess I can live with that.
  Reply With Quote
11-02-22, 10:46 PM   #13
bekaylai
A Murloc Raider
Join Date: Nov 2022
Posts: 4
Originally Posted by p3lim View Post
Try this:

Lua Code:
  1. local Parent = CreateFrame('Frame', nil, UIParent, 'SecureHandlerStateTemplate')
  2. RegisterStateDriver(Parent, 'visibility', 'hide')
  3.  
  4. MainActionBar:SetParent(Parent)
  5. MultiBarBottomLeft:SetParent(Parent)
Sry for necro but this works. Thank you
  Reply With Quote
11-03-22, 01:02 PM   #14
Riketta
A Defias Bandit
Join Date: Nov 2022
Posts: 3
Cheesy way is just use SetAlpha(0). Most of times nothing in default UI will try to recover it, unlike reshow.
  Reply With Quote
11-05-22, 10:25 PM   #15
bekaylai
A Murloc Raider
Join Date: Nov 2022
Posts: 4
Originally Posted by Riketta View Post
Cheesy way is just use SetAlpha(0). Most of times nothing in default UI will try to recover it, unlike reshow.
There's a lot of addon setting the alpha, but all of them doesnt really hide the global cooldown flicker. I just need the mainbar to be completely hidden without the gcd flicker
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Hide "Main Action Bar" and "Bottom Left Bar"

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