Thread Tools Display Modes
08-10-18, 06:51 AM   #1
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Moving the MainMenuBar

Im trying to put the MainmenuBar on top of my Datapanel but I keep having issues.

This is the code ive been trying to use:
Lua Code:
  1. local AdjustBar = function() end
  2.    
  3.     -- Move the MainMenuBar
  4.     MainMenuBar:SetMovable(true)
  5.     MainMenuBar:SetUserPlaced(true)
  6.     MainMenuBar:ClearAllPoints()
  7.     MainMenuBar:SetPoint("BOTTOM",cDataMainPanel,"TOP",0,-4)
  8.     MainMenuBar.ClearAllPoints = AdjustBar
  9.     MainMenuBar.SetMovable = AdjustBar
  10.     MainMenuBar.SetPoint = AdjustBar
  11.     MainMenuBar.SetUserPlaced = AdjustBar
  12.  
  13.     -- Move the MainMenuBar.
  14.     --MainMenuBar:SetMovable(true)
  15.     --MainMenuBar:SetUserPlaced(true)  
  16.     --MainMenuBar:ClearAllPoints()
  17.     --MainMenuBar:SetPoint("BOTTOM",cDataMainPanel,"TOP",0,-4)
  18.    
  19.     -- Move the OverrideActionBar.
  20.     --OverrideActionBar:ClearAllPoints()
  21.     --OverrideActionBar:SetPoint("BOTTOM",cDataMainPanel,"TOP",0,4)
  22.     --OverrideActionBar.ClearAllPoints = AdjustBar
  23.     --OverrideActionBar.SetPoint = AdjustBar
  24.    
  25.     -- Move the ExtraActionButton.
  26.     ExtraActionButton1:ClearAllPoints()
  27.     ExtraActionButton1:SetPoint("CENTER", MainMenuBar, "TOP", 0, 100)
  28.     ExtraActionButton1.ClearAllPoints = AdjustBar
  29.     ExtraActionButton1.SetPoint = AdjustBar
any help would be great.

If you need to se more here is the whole addon cData

Thanks Coke
  Reply With Quote
08-11-18, 03:57 AM   #2
Aftermathhqt
A Molten Giant
 
Aftermathhqt's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2009
Posts: 784
Try

Lua Code:
  1. MainMenuBar.ignoreFramePositionManager = true
  Reply With Quote
08-11-18, 06:16 AM   #3
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
This is what I use in my personal UI:
Code:
local function SetPosition(frame, ...)
    if type(frame) == 'string' then
        UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil
        frame = _G[frame]
    end
    if type(frame) == 'table' and type(frame.IsObjectType) == 'function' and frame:IsObjectType('Frame') then
        local name = frame:GetName()
        if name then
            UIPARENT_MANAGED_FRAME_POSITIONS[name] = nil
        end
        frame:SetMovable(true)
        frame:SetUserPlaced(true)
        frame:SetDontSavePosition(true)
        frame.ignoreFramePositionManager = true
        if ... then
            frame:ClearAllPoints()
            frame:SetPoint(...)
        end
        frame:SetMovable(false)
    end
end
Then you just need to do:
Code:
SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, 10)

SetPosition(ExtraActionBarFrame, "CENTER", MainMenuBar, "TOP", 0, 100)
But you didn't say what issues you were having so I don't know if taint was your problem or if the frames were moving on you.
  Reply With Quote
08-11-18, 07:38 AM   #4
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by Vrul View Post
This is what I use in my personal UI:
Code:
local function SetPosition(frame, ...)
    if type(frame) == 'string' then
        UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil
        frame = _G[frame]
    end
    if type(frame) == 'table' and type(frame.IsObjectType) == 'function' and frame:IsObjectType('Frame') then
        local name = frame:GetName()
        if name then
            UIPARENT_MANAGED_FRAME_POSITIONS[name] = nil
        end
        frame:SetMovable(true)
        frame:SetUserPlaced(true)
        frame:SetDontSavePosition(true)
        frame.ignoreFramePositionManager = true
        if ... then
            frame:ClearAllPoints()
            frame:SetPoint(...)
        end
        frame:SetMovable(false)
    end
end
Then you just need to do:
Code:
SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, 10)

SetPosition(ExtraActionBarFrame, "CENTER", MainMenuBar, "TOP", 0, 100)
But you didn't say what issues you were having so I don't know if taint was your problem or if the frames were moving on you.
This seesm to work.

The issues I was having is that when ever i would get in or out of a NPC vehicle the bars you just keep scrolling between the OverrideActionBar and the MainMenubar untill i disabled the addon. Maybe ity was because it was during the BFA pre launch or not but your suggestion seems to be working. Thanks again.
  Reply With Quote
08-11-18, 09:54 AM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Vrul, does that mean that

UIPARENT_MANAGED_FRAME_POSITIONS[frame] = nil

In essence tells UIParent to stop handling the frame ?

If so its a might bit easier than changing the different functions to do nothing

If you don't mind I might utilise that block of code ( with full credit of course )
__________________
  Reply With Quote
08-11-18, 04:06 PM   #6
Vrul
A Scalebane Royal Guard
 
Vrul's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2007
Posts: 404
No, that table only has entries for certain things. I just nil it out in case that particular one is there (or gets added in the future).

For this case in particular, the code that positions MainMenuBar checks if either it or MicroButtonAnBagsBar IsUserPlaced then that code is skipped. However, ExtraActionBarFrame is in UIPARENT_MANAGED_FRAME_POSITIONS and is handled by a loop that iterates over it's entries. The code called in that loop also checks if ignoreFramePositionManager is set and exits out early.

There is one other case: CastingBarFrame:GetAttribute("ignoreFramePositionManager") so to also handle that you would need:
Code:
local function SetPosition(frame, ...)
    if type(frame) == 'string' then
        frame = _G[frame]
    end
    if type(frame) == 'table' and type(frame.IsObjectType) == 'function' and frame:IsObjectType('Frame') then
        local name = frame:GetName()
        if name then
            UIPARENT_MANAGED_FRAME_POSITIONS[name] = nil
        end
        frame:SetMovable(true)
        frame:SetUserPlaced(true)
        frame:SetDontSavePosition(true)
        frame:SetAttribute('ignoreFramePositionManager', true)
        frame.ignoreFramePositionManager = true
        if ... then
            frame:ClearAllPoints()
            frame:SetPoint(...)
        end
        frame:SetMovable(false)
    end
end
  Reply With Quote
08-11-18, 04:28 PM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,892
Ah, so pretty much what I do at present .. look at what will stop it working and try to implement the same think but that extra stuff I didn't realise we could play with.
__________________
  Reply With Quote
08-12-18, 08:01 AM   #8
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325


Ok so not everything is perfect.
As you can see in the image above when i got out of a NPC vehicle (last part to highmountain quest line bombing run) my number for the mainmenu bar disapeared and now the bar is none clickable. Only way to fix is to do a /reload and reload the UI.

Any thoughts?

Coke

Edit:

As you can see after a reload the bar number is visable and the buttons are clickable once again.

Last edited by cokedrivers : 08-12-18 at 08:03 AM.
  Reply With Quote
08-21-18, 04:07 PM   #9
Drudatz
A Fallenroot Satyr
Join Date: Aug 2009
Posts: 20
Unhappy

Originally Posted by cokedrivers View Post
Ok so not everything is perfect.
As you can see in the image above when i got out of a NPC vehicle (last part to highmountain quest line bombing run) my number for the mainmenu bar disapeared and now the bar is none clickable. Only way to fix is to do a /reload and reload the UI.
I have the EXCACT same problem everytime after I do a Tortollan Quests like Beach Head or Make Loa Go.
Code:
MainMenuBar:SetMovable(true)
MainMenuBar:SetUserPlaced(true)
MainMenuBar:ClearAllPoints()
MainMenuBar:SetPoint("CENTER", UIParent, "BOTTOM", 0, 40)
MainMenuBar:SetScale(0.75)
the strange thing is my MultiBarRight works fine

Code:
MultiBarRight:SetMovable(true)
MultiBarRight:SetUserPlaced(true)
MultiBarRight:ClearAllPoints()
MultiBarRight:SetPoint("BOTTOM", WorldFrame, "RIGHT", -20, -620)
any help would be REALLY apreciated!
  Reply With Quote
08-12-18, 09:49 AM   #10
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
I just relized WoW moved the Xp bar below the MainmenuBar so now if the player is not Max Level the bar shows and my alignment is off.

So Ive been hunting for a solution but cant seem to find one.
Will the following work.
Code:
if UnitLevel("player") == MAX_LEVEL then
   SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, -4)
else
   SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, 9)
end
thanks for any help with this.
Coke
  Reply With Quote
08-12-18, 03:52 PM   #11
thomasjohnshannon
A Theradrim Guardian
 
thomasjohnshannon's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 68
Originally Posted by cokedrivers View Post
I just relized WoW moved the Xp bar below the MainmenuBar so now if the player is not Max Level the bar shows and my alignment is off.

So Ive been hunting for a solution but cant seem to find one.
Will the following work.
Code:
if UnitLevel("player") == MAX_LEVEL then
   SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, -4)
else
   SetPosition(MainMenuBar, "BOTTOM", cDataMainPanel, "TOP", 0, 9)
end
thanks for any help with this.
Coke
A little off topic but you can replace the max level bit with IsPlayerAtEffectiveMaxLevel(). They just added it to the api recently. They added that one and a few others.

Lua Code:
  1. -- takes into account the current expansion
  2.  -- NOTE: it's not safe to cache this value as it could change in the middle of the session
  3. function GetEffectivePlayerMaxLevel()
  4.   return MAX_PLAYER_LEVEL_TABLE[GetExpansionLevel()];
  5. end
  6.  
  7. function IsLevelAtEffectiveMaxLevel(level)
  8.   return level >= GetEffectivePlayerMaxLevel();
  9. end
  10.  
  11. function IsPlayerAtEffectiveMaxLevel()
  12.   return IsLevelAtEffectiveMaxLevel(UnitLevel("player"));
  13. end
__________________
Thomas aka Urnn
  Reply With Quote
08-13-18, 06:58 AM   #12
cokedrivers
A Rage Talon Dragon Guard
 
cokedrivers's Avatar
AddOn Author - Click to view addons
Join Date: Aug 2009
Posts: 325
Originally Posted by thomasjohnshannon View Post
A little off topic but you can replace the max level bit with IsPlayerAtEffectiveMaxLevel(). They just added it to the api recently. They added that one and a few others.

Lua Code:
  1. -- takes into account the current expansion
  2.  -- NOTE: it's not safe to cache this value as it could change in the middle of the session
  3. function GetEffectivePlayerMaxLevel()
  4.   return MAX_PLAYER_LEVEL_TABLE[GetExpansionLevel()];
  5. end
  6.  
  7. function IsLevelAtEffectiveMaxLevel(level)
  8.   return level >= GetEffectivePlayerMaxLevel();
  9. end
  10.  
  11. function IsPlayerAtEffectiveMaxLevel()
  12.   return IsLevelAtEffectiveMaxLevel(UnitLevel("player"));
  13. end
thank you for this
  Reply With Quote
08-14-18, 10:19 PM   #13
siweia
A Flamescale Wyrmkin
 
siweia's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2011
Posts: 126
Code:
8/15 11:57:08.685  An action was blocked in combat because of taint - MainMenuBar:SetPoint()
8/15 11:57:08.685      Interface\FrameXML\UIParent.lua:2943 <unnamed>:UIParentManageFramePositions()
8/15 11:57:08.685      Interface\FrameXML\UIParent.lua:2326
8/15 11:57:08.685      <unnamed>:SetAttribute()
8/15 11:57:08.685      Interface\FrameXML\UIParent.lua:3115
8/15 11:57:08.685      UIParent_ManageFramePositions()
8/15 11:57:08.685      Interface\FrameXML\PetActionBarFrame.lua:36
8/15 11:57:08.685      NDui_PetActionBar:Show()
8/15 11:57:08.685      Interface\FrameXML\SecureStateDriver.lua:100 resolveDriver()
8/15 11:57:08.685      Interface\FrameXML\SecureStateDriver.lua:127
Is there any way to hide the MainMenuBar without taint?
I just reparent it to a hidden frame, but causing taint.
  Reply With Quote
08-15-18, 08:28 AM   #14
Taudier
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 53
MainMenuBar:SetMovable(true)
MainMenuBar:SetUserPlaced(true)
MainMenuBar:SetPoint("BOTTOM", 100, 20)

-- this part to restore the MainMenuBar after vehicule exit
CreateFrame("frame", nil, nil, "SecureHandlerBaseTemplate" ):WrapScript(ActionButton1, "OnShow", [[
local MainMenuBarArtFrame = self:GetParent()
local MainMenuBar = MainMenuBarArtFrame:GetParent()
local UIParent = MainMenuBar:GetParent()
MainMenuBar:SetPoint("BOTTOM", UIParent, "BOTTOM", 100, 20)
]])

*it doesn't work if you display the right bottom multibar

Is there any way to hide the MainMenuBar without taint?
MainMenuBar:EnableMouse(false)
MainMenuBarArtFrame:Hide()

but you will have to make adjustment to other frames

Last edited by Taudier : 08-15-18 at 12:22 PM.
  Reply With Quote
08-23-18, 03:11 PM   #15
Drudatz
A Fallenroot Satyr
Join Date: Aug 2009
Posts: 20
Red face

Okay with Taudiers tip it works now
(even though I HAVE MultiBarRight enabled and visible).
I just react on PLAYER_CONTROL_GAINED and it works again.

Code:
		if event:match("PLAYER_CONTROL_GAINED") then
			CreateFrame("frame", nil, nil, "SecureHandlerBaseTemplate" ):WrapScript(ActionButton1, "OnShow", [[
				print("ACTION!")
				local MainMenuBarArtFrame = self:GetParent()
				local MainMenuBar = MainMenuBarArtFrame:GetParent()
				local UIParent = MainMenuBar:GetParent()
				MainMenuBar:SetPoint("CENTER", UIParent, "BOTTOM", 0, 40)
			]])
		end

Last edited by Drudatz : 08-23-18 at 03:28 PM.
  Reply With Quote
08-26-18, 02:30 AM   #16
Taudier
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 53
Originally Posted by Drudatz View Post
Okay with Taudiers tip it works now
(even though I HAVE MultiBarRight enabled and visible).
I just react on PLAYER_CONTROL_GAINED and it works again.

Code:
		if event:match("PLAYER_CONTROL_GAINED") then
			CreateFrame("frame", nil, nil, "SecureHandlerBaseTemplate" ):WrapScript(ActionButton1, "OnShow", [[
				print("ACTION!")
				local MainMenuBarArtFrame = self:GetParent()
				local MainMenuBar = MainMenuBarArtFrame:GetParent()
				local UIParent = MainMenuBar:GetParent()
				MainMenuBar:SetPoint("CENTER", UIParent, "BOTTOM", 0, 40)
			]])
		end
it doesn't work only with the Bottom MultiBarRight. For the other bars it works fine. Your code is wrong, primarily because you can't create a SecureFrame ("SecureHandlerBaseTemplate") in combat. Why do you need to react on "PLAYER_CONTROL_GAINED" ? When you exit a vehicule it triggers MainMenuBar "OnShow". Any scenario where it didn't work ?
  Reply With Quote
08-26-18, 12:41 PM   #17
Drudatz
A Fallenroot Satyr
Join Date: Aug 2009
Posts: 20
Originally Posted by Taudier View Post
it doesn't work only with the Bottom MultiBarRight. For the other bars it works fine. Your code is wrong, primarily because you can't create a SecureFrame ("SecureHandlerBaseTemplate") in combat. Why do you need to react on "PLAYER_CONTROL_GAINED" ? When you exit a vehicule it triggers MainMenuBar "OnShow". Any scenario where it didn't work ?
doesnt matter if OnShow or Control Gained it only works for me at max level (120) anyway.
When I level and for example do the quests Forcing Fate's Hand (where you control the undead hand at the dead turtle loa) afterwards the bottom bar is completely unusable.
  Reply With Quote
08-27-18, 01:05 AM   #18
Taudier
A Wyrmkin Dreamwalker
AddOn Author - Click to view addons
Join Date: Apr 2008
Posts: 53
well, if every wrong codes didn't work at all i guess they all would work

Last edited by Taudier : 08-27-18 at 01:42 AM.
  Reply With Quote
08-27-18, 01:53 AM   #19
zork
A Pyroguard Emberseer
 
zork's Avatar
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 1,740
Hmmm...I have no problems with the main menu bar in rActionBar.
That is of course because I am disabling the default main menu bar and the override action bar. I am using all the buttons though by reparenting them.
Couldn't you just put a background texture somewhere and put sth like rActionBar (or any other bar mod) on top if it is giving you so much trouble?
__________________
| Simple is beautiful.
| WoWI AddOns | GitHub | Zork (WoW)

"I wonder what the non-pathetic people are doing tonight?" - Rajesh Koothrappali (The Big Bang Theory)
  Reply With Quote
08-27-18, 03:18 PM   #20
Drudatz
A Fallenroot Satyr
Join Date: Aug 2009
Posts: 20
Originally Posted by zork View Post
Hmmm...I have no problems with the main menu bar in rActionBar.
That is of course because I am disabling the default main menu bar and the override action bar. I am using all the buttons though by reparenting them.
Couldn't you just put a background texture somewhere and put sth like rActionBar (or any other bar mod) on top if it is giving you so much trouble?
Well the problem started with BFA when I had to use
Code:
MainMenuBar:SetMovable(true)
MainMenuBar:SetUserPlaced(true)
MainMenuBar:ClearAllPoints()
MainMenuBar:SetPoint("CENTER", UIParent, "BOTTOM", 0, 40)
just so that MainMenuBar:SetScale(0.75) would work again.

What is strange is that it ONLY affects MainMenuBar but NOT MultiBarRight and that
Taudiers fixes it IF the toon is max level.

@Taudier: what is wrong about YOUR code?
  Reply With Quote

WoWInterface » Developer Discussions » Lua/XML Help » Moving the MainMenuBar

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